Created
July 27, 2017 08:44
-
-
Save egormerkushev/5b9dc93d7a1b39d2e998c63326820aa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Timer from 'react-native-timer' | |
... | |
render() { | |
return ( | |
... | |
<Text>Time left: {this.state.timeLeftText}</Text> | |
... | |
) | |
} | |
_startRenderTimer() { | |
Timer.setInterval( | |
this, | |
RenderTimerName, | |
this._renderTimerCycle.bind(this), | |
250) // 4 times per second | |
} | |
_renderTimerCycle() { | |
... | |
if (this.tmpTime !== fireIntervalString) { | |
this.tmpTime = fireIntervalString | |
this.setState({ | |
timeLeftText: fireIntervalString, | |
}) | |
} | |
... | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment