react-native-ui-lib
react-native-ui-lib copied to clipboard
Dialogs not showing on IOS
simulator IOS: 13.1 Expected behavior - after the first dialog closes the second one appear State changes, but the second dialog don't appear Working fine on Android, only ios issue
` const [isFirstDialogOpen, setIsFirstDialogOpen] = useState(false); const [isSecondDialogOpen, setIsSecondDialogOpen] = useState(false);
<Dialog
visible={isFirstDialogOpen}
onDismiss={() => setIsFirstDialogOpen(false)}
>
<Button
onPress={() => {
setIsFirstDialogOpen(false);
setIsSecondDialogOpen(true);
}}
>
<Text>Close</Text>
</Button>
</Dialog>
<Dialog
visible={isSecondDialogOpen}
onDismiss={() => setIsSecondDialogOpen(false)}
>
<Button onPress={() => setIsSecondDialogOpen(false)}>
<Text>Close</Text>
</Button>
</Dialog>
`
Please let us know if the following workaround is good enough:
<Dialog
visible={isFirstDialogOpen}
onDismiss={() => this.setIsFirstDialogOpen(false)}
onModalDismissed={() => this.setIsSecondDialogOpen(true)} // this works only for iOS
>
<Button
onPress={() => {
this.setIsFirstDialogOpen(false);
if (Constants.isAndroid) {
this.setIsSecondDialogOpen(true);
}
}}
>
<Text>Close</Text>
</Button>
</Dialog>
<Dialog visible={isSecondDialogOpen} onDismiss={() => this.setIsSecondDialogOpen(false)}>
<Button onPress={() => this.setIsSecondDialogOpen(false)}>
<Text>Close</Text>
</Button>
</Dialog>