0.1.1 • Published 7 years ago

react-native-hyper-text v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

React Native Hyper Text

NPM version

A <HyperText /> component for react-native that makes urls, telephones etc clickable

Installation

npm i --save react-native-hyper-text

Props

namedesctypedefault
styletext with stylesText.propTypes.style-
linkColorhighlight clickable text with colorstringblue(#0000EE)
underLinehighlight clickable text with underLinebooleantrue
linkifyTelhighlight telephone as a clickable textbooleanfalse
onClickfunc to handle click over a clickable text with parsed text as argfunctionopen in browseror dialer
onLongClickfunc to handle long click over a clickable text with parsed text as argfunction-

Examples

import HyperText from 'react-native-hyper-text'

export const regularText = () =>
  <HyperText style={{fontSize:14}} onClick={ url => alert(url) }>
    This text will be parsed to check for clickable strings like https://github.com/imchintan/react-native-hyper-text and made clickable.
  </HyperText>

export const textWithoutUnderLine = () =>
  <HyperText style={{fontSize:14}} underLine={false} onClick={ url => alert(url) }>
    This text will be parsed to check for clickable strings like https://github.com/imchintan/react-native-hyper-text and made clickable.
  </HyperText>

export const textLinkifyTelePhone = () =>
  <HyperText style={{fontSize:14}} linkifyTel={true} onClick={ url => alert(url) }>
    This text will be parsed to check for clickable strings like https://github.com/imchintan/react-native-hyper-text or +123 512 (1234) and made clickable.
  </HyperText>

export const regularTextLongPress = () =>
  <HyperText onLongClick={ url => alert(url) }>
      This text will be parsed to check for clickable strings like https://github.com/imchintan/react-native-hyper-text and made clickable for long click.
  </HyperText>

export const highlightText = () =>
  <HyperText linkColor='#2980b9'>    
      Make clickable strings like https://github.com/imchintan/react-native-hyper-text stylable
  </HyperText>

License

MIT License