1.0.7 • Published 4 years ago

react-native-twitter-textview v1.0.7

Weekly downloads
93
License
MIT
Repository
github
Last release
4 years ago

react-native-twitter-textview

A <Text/> component for React Native and React Native Web that automatically detects #hashtags and @mentions.

🚀 Getting Started

Using npm:

npm install --save react-native-twitter-textview

Using yarn:

yarn add react-native-twitter-textview

✍️ Usage

It's super easy; just replace your React Native <Text /> component with a <TwitterTextView />, and there you go!

const App = () => {
  const [value, onChangeText] = useState('');
  return (
    <View
      style={StyleSheet.absoluteFill}
    >
      <TextInput
        onChangeText={onChangeText}
        value={value}
        placeholder="Type some #hashtags or @mentions to get started."
        multiline
        numberOfLines={4}
      />
      <TwitterTextView
        style={styles.twitterTextView}
        hashtagStyle={styles.hashtagStyle}
        mentionStyle={styles.mentionStyle}
        linkStyle={styles.linkStyle}
        emailStyle={styles.emailStyle}
      >
        {value}
      </TwitterTextView>
    </View>
  );
}

✍️ Input

Are you looking for a similar component for tagged <TextInput/>? If so, please check out react-native-segmented-text-input.

📋 Props


PropTypeDefaultRequiredDescription
childrenstring''NoThe text to render.
extractHashtagsbooltrueNoWhether you wish to support hashtags.
onPressHashtagfunc(e, hashtag) => nullNoCalled when a detected hashtag is clicked.
hashtagStyleshapeobject Objectstyles.linkStyleNoHashtag style.
extractMentionsbooltrueNoWhether you wish to support mentions.
onPressMentionfunc(e, hashtag) => nullNoCalled when a detected mention is clicked.
mentionStyleshapeobject Objectstyles.linkStyleNoMention style.
extractLinksbooltrueNoWhether you wish to support links.
onPressLinkfunc(e, link) => Linking.openURL(link)NoCalled when a detected link is clicked.
linkStyleshapeobject Objectstyles.linkStyleNoLink style.
extractEmailsbooltrueNoWhether you wish to support emails.
onPressEmailfunc(e, link) => Linking.openURL(link)NoCalled when a detected email is clicked.
emailStyleshapeobject Objectstyles.linkStyleNoEmail style.

✌️ License

MIT

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago