Advertisement
zidniryi

Untitled

May 7th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <TimerCountdown
  2. initialMilliseconds={1000 * 0}
  3. onTick={(milliseconds) => console.log("tick", milliseconds)}
  4. onExpire={() => console.log('hello')}
  5. formatMilliseconds={(milliseconds) => {
  6. const remainingSec = Math.round(milliseconds / 1000);
  7. const seconds = parseInt((remainingSec % 60).toString(), 10);
  8. const minutes = parseInt(((remainingSec / 60) % 60).toString(), 10);
  9. const hours = parseInt((remainingSec / 3600).toString(), 10);
  10. const s = seconds < 10 ? '0' + seconds : seconds;
  11. const m = minutes < 10 ? '0' + minutes : minutes;
  12. let h = hours < 10 ? '0' + hours : hours;
  13. h = h === '00' ? '' : h + ':';
  14. return s == '00' ? <View>
  15. <TouchableOpacity onPress={() => this.setState({
  16. timeCount: 'A'
  17. })}>
  18. <Text>Jangkrik</Text>
  19. </TouchableOpacity>
  20. </View> : h + m + ':' + s
  21. }}
  22. allowFontScaling={true}
  23. style={styles.textTwo}
  24. />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement