我的问题是 setTimeout 运行 about 5 seconds
早些时候。
例如,当我将其设置为5 seconds
,它立即运行,但是当我在15 seconds
,它将运行大约10 seconds
later.
我什至调查了这个问题:React Native 中的 setTimeout https://stackoverflow.com/questions/34504322/settimeout-in-react-native,但我还是没能解决问题
changeNotify() {
let that = this;
console.log("before");
setTimeout(function () {
console.log("After");
that.setState({notifyModal: false})
}, 5000);
}
并且在渲染中
<Button
title='change'
onPress={() => this.setState({notifyModal: true},()=>this.changeNotify())}
/>
上面的代码是正确的。????
有一个问题,因为我在debug mode
而且我的设备时间与我的电脑时间不匹配!
这发生在我身上,不幸的是,我花了很长时间来调试????
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)