-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { DevOnly } from '@site/src/components'; | ||
|
||
# SwitchWrapper | ||
|
||
The component provides built-in accessibility implementation for creating a custom switch. | ||
|
||
## Usage | ||
|
||
```jsx pf | ||
import {SwitchWrapper} from 'react-native-ama'; | ||
|
||
<SwitchWrapper | ||
accessibilityLabel={accessibilityLabel} | ||
style={[allStyles.container, style]} | ||
onPress={onValueChange} | ||
checked={value}> | ||
<CustomSwitcher checked={checked} onPress={onValueChanged}> | ||
</SwitchWrapper> | ||
``` | ||
|
||
## Accessibility | ||
|
||
The component uses the [useSwitch](./hooks/useSwitch.md) hook under the hood and: | ||
|
||
- Sets the [accessibilityRole](../../../website/guidelines/accessibility-role.md) property to **switch** | ||
- Handled the [accessibilityState](https://reactnative.dev/docs/accessibility#accessibilitystate) needed by the Screen Reader | ||
- Performs a [Minimum Size](../../../website/guidelines/minimum-size.md) check <DevOnly /> | ||
- Performs a check on the [accessibilityLabel](../../../website/guidelines/accessibility-label.md) <DevOnly /> | ||
|
||
## Related guidelines | ||
|
||
- [Forms](../../../website/guidelines/forms.md) |