React-Native 0.20 - setInterval not working as expected -
has been able setinterval
working expected react-native? having inconsistent results where:
1) delay before execution not match ms
delay set
2) further executions after initial 1 do not always occur, do.
my interval code in component, shown:
componentdidmount() { this.syncfunc = setinterval(() => { this.props.actions.syncstate() }, 5000) } componentwillunmount() { clearinterval(this.syncfunc) }
i've tried timermixin included in react-native, don't think it's supported @ point. code similar:
componentdidmount() { this.syncfunc = timermixin.settimeout(() => { this.props.actions.syncstate() , 5000) } componentwillunmount() { timermixin.cleartimeout(this.syncfunc) }
appreciate advice others who've tinkered this. thanks!
Comments
Post a Comment