react-native-paper
react-native-paper copied to clipboard
fix: switch state sync when used inside a Portal on iOS
Motivation
When a <Switch /> is inside a <Portal /> you must tap the switch component twice to visually toggle the state on iOS.
Related issue
Fixes #4789
Test plan
I updated the example app to Expo 54, and then added this code in the SwitchExample.tsx file and tried toggling with a single tap.
<Portal>
<View style={[styles.row, { top: 500 }]}>
<TextComponent>Portal {checked ? 'on' : 'off'}</TextComponent>
<Switch value={checked} onValueChange={setChecked} />
</View>
</Portal>
Hey @PaitoAnderson, thank you for your pull request 🤗. The documentation from this branch can be viewed here.