-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimeBar.js
37 lines (31 loc) · 880 Bytes
/
TimeBar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React, { Component, PropTypes } from 'react';
import { View, Text, TouchableHighlight,Navigator, Image, TouchableOpacity, StyleSheet } from 'react-native';
var styles = require('./styles');
var nav;
export default class TimeBar extends Component {
constructor(props){
super(props);
this.state = {
timeLeft:600,
}
var tickDown = ()=>{
var newState = this.state.timeLeft-1;
this.setState({timeLeft:newState});
}
setInterval(tickDown,100);
}
render() {
var dW = Math.floor(360*(this.state.timeLeft/600));
var dStyle = StyleSheet.create({
fillWidth: {
width: dW,
}
});
return(
<View style={styles.timeBarContainer}>
<View style={styles.timeBarBG}/>
<View style={[styles.timeBar,dStyle.fillWidth]}/>
</View>
)
}
}