Skip to content

Commit 63c618c

Browse files
authored
Merge pull request #1 from ngxhuyhoang/feature/get-annontation-content
feat: get token content when pressed
2 parents 1f893d2 + aa67cb8 commit 63c618c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
Text,
77
View,
88
StyleSheet,
9+
GestureResponderEvent,
910
} from 'react-native';
1011

1112
const useStyles = () => {
@@ -74,7 +75,13 @@ const AttributedText = ({
7475
}
7576
const tokenProps = annotationProps && annotationProps[token.annotation];
7677
return (
77-
<Text {...tokenProps} key={index}>
78+
<Text
79+
{...tokenProps}
80+
onPress={(event: GestureResponderEvent) =>
81+
tokenProps.onPress({ ...event, content: token.content })
82+
}
83+
key={index}
84+
>
7885
{token.content}
7986
</Text>
8087
);

0 commit comments

Comments
 (0)