Created
May 19, 2022 18:24
-
-
Save Saadnajmi/7f920a8cafb1460d411f1073cff8ef15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ListAccessibilityExamples: React.FunctionComponent = () => { | |
const [showImage, setShowImage] = React.useState(true); | |
const [showPresence, setShowPresence] = React.useState(false); | |
const [showRing, setShowRing] = React.useState(false); | |
const redSquareStyle: ViewStyle = { width: 20, height: 20, margin: 10, backgroundColor: 'red' }; | |
const cardStyle: ViewStyle = { width: 40, height: 40, margin: 10, backgroundColor: 'white', borderWidth: 1 }; | |
return ( | |
<View> | |
<Text>Simple List</Text> | |
{/* Outer View has accessibilityRole "list", and at least one inner view has an AccessibilityLabel */} | |
<View accessibilityRole={'list'} accessible> | |
<View accessible accessibilityLabel={'A red box'} style={redSquareStyle} /> | |
<View accessible style={redSquareStyle} /> | |
<View accessible style={redSquareStyle} /> | |
</View> | |
<Text>List with cards (not accessible), and inner views (acessible)</Text> | |
{/* Outer View has accessibilityRole "list", and at least one inner view has an AccessibilityLabel */} | |
<View accessibilityRole={'list'} accessible> | |
<View style={cardStyle}> | |
<View accessible accessibilityLabel={'A red box'} style={redSquareStyle} /> | |
</View> | |
<View style={cardStyle}> | |
<View accessible accessibilityLabel={'A red box'} style={redSquareStyle} /> | |
</View> | |
<View style={cardStyle}> | |
<View accessible accessibilityLabel={'A red box'} style={redSquareStyle} /> | |
</View> | |
</View> | |
</View> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment