Pressable
Pressable is an extension of the React Native Pressable component, focused on accessibility.
import { Pressable } from 'react-native-ama';
<Pressable accessibilityRole="button" accessibilityLabel="I'm pressable!">
<Text>I'm pressable</Text>
</Pressable>;
Accessibility improvements
Compared to the default React Native component, this custom component:
- Forces the use of
accessibilityRole
andaccessibilityLabel
accessibilityState
has been removed as its statesbusy
,checked
,selected
,expanded
are exposed as a property- Performs a Minimum Size check
- Performs a contrast checker between its background color and its children color
accessibilityRole
The accessibilityRole
property is used by the screen reader to announce the kind of element focused on. If the property is omitted, the user might have little to no clue what could happen if the element is triggered.
accessibilityLabel
The accessibilityLabel
property is the first thing announced by the screen reader when the elements gain the focus; then, it announces its role. If the property is omitted, the user might have little to no clue what could happen if the element is triggered.