android - Alert.alert 在 React 本机 iOS 中不起作用,但在 Android 中非常好
问题描述
请检查代码,
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}
/>
)}
此代码段在 android 中可以正常工作,但在 iOS 中不显示。为什么 ?
注意:- 这是我现在可以分享的大部分代码,编辑过的代码请立即检查,如果您有任何问题,请告诉我。
解决方案
我不完全知道发生了什么,还有一个模型组件用于显示自定义加载,删除模型组件后警报开始工作。
推荐阅读
- c# - 屏幕闪烁的解决方法
- javascript - 通过对象使用 SVG,不想工作
- c++11 - 运算符 new 未定义
- c# - Json Query 在 MCV 中未正确显示
- excel - 综合结果的高分列表
- entity-framework-core - 如何在 Entity Framework Core Migrations 中创建 dbContext 的实例?
- angular - Angular 路由更改后,面包屑并不总是更新
- python - 试图获取足球队所有球员的球员名单,但只获得第一个球员?
- nlp - 具有预定义词性的斯坦福 CoreNLP 词形还原
- go - 从 []bytes 解析浮点值的最佳方法是什么?