@@ -106,6 +106,9 @@ const styles = StyleSheet.create({
106
106
width : 25 ,
107
107
height : 25 ,
108
108
} ,
109
+ link : {
110
+ color : 'blue' ,
111
+ } ,
109
112
} ) ;
110
113
111
114
class AccessibilityExample extends React . Component < { } > {
@@ -1737,6 +1740,39 @@ function AccessibilityOrderExample(): React.Node {
1737
1740
) ;
1738
1741
}
1739
1742
1743
+ function TextLinkExample ( ) : React . Node {
1744
+ const handleLinkPress = ( linkText : string ) => {
1745
+ Alert . alert ( 'Link Clicked' , `You clicked on the ${ linkText } link!` ) ;
1746
+ } ;
1747
+
1748
+ return (
1749
+ < View style = { { gap : 10 } } >
1750
+ < RNTesterText >
1751
+ We can focus{ ' ' }
1752
+ < RNTesterText
1753
+ accessibilityRole = "link"
1754
+ onPress = { ( ) => handleLinkPress ( 'first' ) }
1755
+ style = { styles . link } >
1756
+ links
1757
+ </ RNTesterText > { ' ' }
1758
+ in text, even if there are{ ' ' }
1759
+ < RNTesterText
1760
+ accessibilityRole = "link"
1761
+ onPress = { ( ) => handleLinkPress ( 'second' ) }
1762
+ style = { styles . link } >
1763
+ multiple of them!
1764
+ </ RNTesterText >
1765
+ </ RNTesterText >
1766
+ < RNTesterText
1767
+ accessibilityRole = "link"
1768
+ onPress = { ( ) => handleLinkPress ( 'thrid' ) }
1769
+ style = { styles . link } >
1770
+ We can also focus text that are entirly links!
1771
+ </ RNTesterText >
1772
+ </ View >
1773
+ ) ;
1774
+ }
1775
+
1740
1776
exports . title = 'Accessibility' ;
1741
1777
exports . documentationURL = 'https://reactnative.dev/docs/accessibilityinfo' ;
1742
1778
exports . description = 'Examples of using Accessibility APIs.' ;
@@ -1840,4 +1876,10 @@ exports.examples = [
1840
1876
return < AccessibilityOrderExample /> ;
1841
1877
} ,
1842
1878
} ,
1879
+ {
1880
+ title : 'Links in text' ,
1881
+ render ( ) : React . MixedElement {
1882
+ return < TextLinkExample /> ;
1883
+ } ,
1884
+ } ,
1843
1885
] ;
0 commit comments