Reputation: 1635
I was trying to make some authentication system in which after click on sign up user is asked for otp. I made a modal for Otp using modal tag which only get visible when some value becomes true. Whenever user submits a otp i open up a alert box saying sign in now and change that modal visibile to false. But while doing this I faced a problem in Ios. This is working fine in android but while trying with ios device phone hangs up on modal screen and does not go back.
Upvotes: 1
Views: 2661
Reputation: 3783
So this is a quite known problem with modals and alert since the alert
itself is a form of modal(overlay item) and setState
occurs asynchronous so the actions kind of block each other and the whole UX gets hung.You need to do is just synchronize the OTP modal closing and alerting.
Edited: Better add timeout to your alert using setTimeOut(()=>Alert.alert(), 0);
The code should look like that:
this.setState({
isOTPModalVisible: false
}, () => {
Alert.alert('message');
})
Upvotes: 1