1.0.4 • Published 3 years ago

rn-text-and-links v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

React Native Text and Links

Add one or more onPress events to a string in React Native

Install

yarn add rn-text-and-links
npm i rn-text-and-links

Example

import React, {ReactElement} from 'react';
import {SafeAreaView} from 'react-native';
import {TextAndLinks, ITextAndLinksProps} from 'rn-text-and-links';

export const App = (): ReactElement => {
  const props: ITextAndLinksProps = {
    linkStyles: {color: 'blue'},
    text: 'This is the text that includes links to things in the app and on the web',
    links: [
      {
        text: 'includes links',
        onPress: () => console.log('first link clicked'),
      },
      {
        text: 'in the app',
        onPress: () => console.log('second link clicked'),
      },
      {
        text: 'on the web',
        onPress: () => console.log('third link clicked'),
      },
    ],
  };

  return (
    <SafeAreaView>
      <TextAndLinks {...props} />
    </SafeAreaView>
  );
};

Props

text: string
links: { text: string, onPress: () => void }[]
textStyles?: TextStyle
linkStyles?: TextStyle
linkContainerStyles?: ViewStyle
containerStyles?: ViewStyle
1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago