react-native-parsed-text
react-native-parsed-text copied to clipboard
Multiple hashtags
Hi there, When the text has multiple hashtag, how could I know witch of them was pressed? e.g: Nice job! #foo #bar
I'd like to do a feature likes Instagram, search for specific hashtag, but onPress is generic. Thanks
pattern:
{
pattern: /#[^\s!@#$%^&*()=+./,\[{\]};:'"?><،؛؟-]+/gi,
style: [_linkStyle, linkStyle, boldFont],
onPress: handleHashtagPress,
}
on press hashtag:
const handleHashtagPress = (value, matchIndex) => {
navigation.push('Posts', {
hashtag: {text: value.slice(1)}, // value.slice(1): value without # sign
});
};