1.0.1 • Published 7 months ago

react-native-text-link v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

TextLink

When you need to insert a link inside a text in React Native, you might notice that the links have a different positioning, they are usually around 5 pixels under the line. This happens because the link is actually inside a View (wrapped in a Pressable/TouchableOpacity), so the positioning of the elements is different between a Text and a View.

This package aims to easily solve this while still looking clean. Using this package you will be able to provide a different Style while the link is being pressed.

Usage

First install:

npm i react-native-text-link

Then import:

import  TextLink  from  'react-native-text-link';

Then use:

<TextLink links={[
	{
		text: 'Terms & Conditions',
		onPress: () =>  console.log('link to terms'),
	},
	{
		text: 'Privacy Policy',
		onPress: () =>  console.log('link to privacy'),
	},
]}>
Please read our Terms & Conditions and our Privacy Policy.
</TextLink>

Features

propstypeuse
textStyleStylePropdefault style for text
textLinkStyleStylePropstyle for the links
pressingLinkStyleStylePropstyle for the links while they are being pressed
links{ text: string, onPress: () => void }strings that will act as links and the action they will trigger
childrenstringthe whole text in which the links will be found

License and Constributions

MIT License and thanks to react-native-parsed-text

1.0.1

7 months ago

1.0.0

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago