New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-hyperlink-text

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-hyperlink-text

Wrapper component for text with hyperlinks

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

Text with Linking

NPM version Downloads Build Status

Usage

import { StyleSheet } from 'react-native';
import HyperlinkText from 'react-native-hyperlink-text';

const styles = StyleSheet.create({
  link: {
    color: 'blue',
    fontSize: 22,
  },
  base: {
    color: 'black',
    fontSize: 18,
  },
});

<HyperlinkText
  value={'Visit my website and check out my portfolio @https://friendly-robot.netlify.com/portfolio'}
  baseStyle={styles.base}
  linkStyle={styles.link}
/>

React Native Hyperlink Text

Installation

npm i -S react-native-hyperlink-text

Props

value

A string containing urls or not (refer to hyperlinks) that will be converted to a series of <Text> wrapping the content.

An array of objects each with a key value pair for assigning urls to keywords.
For example: [{ portfolio: 'https://friendly-robot.netlify.com/portfolio' }]

This will map every instance of "portfolio" and transform it into a link that directs to that url. This means that the value and hyperlinks in the example above will look like this:

<HyperlinkText
  value={'Vist my website and check out my portfolio!'}
  hyperlinks={[
    { website: 'https://friendly-robot.netlify.com' },
    { portfolio: 'https://friendly-robot.netlify.com/portfolio' }
  ]}
  baseStyle={styles.base}
  linkStyle={styles.link}
/>

React Native Hyperlink Text

baseStyle

A style object to apply to all <Text> elements.

linkStyle

A style object to apply only to hyperlink <Text> elements.

TODO

Map hyperlinks backwards as well, meaning if the link is provided in the string, every instance of it will be shortened to a keyword. Currently the opposite is true: keywords are turned into links.

License

License The MIT License Copyright (c) 2019 Andy Li

FAQs

Package last updated on 25 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts