Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

Alert.alert not working in React native iOS, but perfectly fine in Android

$
0
0

Please check the code ,

import { 
  Alert,
} from 'react-native';

 checkForSendingOtp = () => {
    let hash = 'aBcDeGgd';
    Platform.OS === 'android'
     ? RNOtpVerify.getHash()
        .then(text => {
          hash = text + ''.replace('[', '');
          hash = hash + ''.replace(']', '');
        })
        .then(() => {
          this.sendDataForOtp(hash);
        })
        .catch(console.log)
    : this.sendDataForOtp(hash);
  };

sendDataForOtp(hash) {

axios.post(url,{hash:hash}).then(response=>{
  Alert.alert(
    'Login Failed',
    'Multiple Logins Are Found. \n Logout From All Other Devices to Continue.',
    [
      {
        text: 'Proceed ?',
        onPress: () => {}                       
      },
      {
        text: 'No',
        onPress: () => {},
      },
    ],
    {cancelable: false},
   );
  });
}


render() {
   return (
    <Ripple
        style={{
           position: 'absolute',
           top: 0,
           bottom: 0,
           left: 0,
           right: 0,
              }}
        onPress={this.checkForSendingOtp}
    />
)}

This snippet will work fine in android but not showing in iOS. why ?

Nb :- this is the most of the code that I can share right now , Edited the code please check it now and let me know if you have any questions.


Viewing all articles
Browse latest Browse all 16552

Trending Articles