清除间隔功能在React Native中不起作用

时间:2019-12-08 02:50:00

标签: react-native

gcc

调用.so时,设置的间隔可以正常工作,但是当 checkdrivercame(id) { var counttime = 0; this.intervalid=setInterval(() => { counttime++ if (counttime > 5) { this.snackbarref.current.triggeranimate('Sorry!!, No cabs found in this location') this.setState({tooglebookstatus:true}, () => { this.animbuttonref.current.stopanim() this.animbuttonref.current.rerender() clearInterval(this.intervalid) }) } }, 5000); } 达到6时,if块也可以执行,但checkdrivercame()除外,

环境:

counttime

过去两天,我一直在处理此问题,请帮帮我,即使在无法使用的情况下,我也尝试在范围之外使用clearInterval,但是计时器一直循环运行。

0 个答案:

没有答案