-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
100 lines (82 loc) · 2.38 KB
/
App.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import React from 'react';
import { StyleSheet, Text, View, Animated, Easing,Dimensions } from 'react-native';
import BoxView from './Components/box.component.js';
const { width } = Dimensions.get("window");
export default class App extends React.Component {
constructor(props){
super(props)
//this.spinValue = new Animated.Value(0)
this.state = {
greenTimer: (1000 ),
orangeTimer: (1000 * 60 * 5),
redTimer: (1000 * 60 * 5),
//spinValue: new Animated.Value(0)
}
/*
this.state = {
// 'greenTimer': (1000 * 60 * 15), //15 minutes = 1000 ms * 60s * 15
greenTimer: (1000 ),
orangeTimer: (1000 * 60 * 5),
redTimer: (1000 * 60 * 5),
};
*/
}
/*
*/
shouldComponentUpdate() {
return false
}
componentDidMount () {
//this.spin()
}
/*
spin () {
Animated.timing(
this.state.spinValue,
{
toValue: 1,
duration: 4000,
easing: Easing.linear,
useNativeDriver: true,
}
).start((e) => {
if(e.finished){
this.spin()
}
})
}
<Animated.Image
style={{
width: 227,
height: 200,
transform: [{rotate: this.state.spinValue.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '360deg']
})}]
}}
source={{uri: 'https://s3.amazonaws.com/media-p.slid.es/uploads/alexanderfarennikov/images/1198519/reactjs.png'}}
/>
*/
render() {
return (
<View style={{flex: 1,backgroundColor:'powderblue' }}>
<View style={{ flex:.9,alignItems:'center', marginTop:30}} >
<BoxView color="red" darkcolor="maroon" timer={this.state.redTimer } delay={this.state.greenTimer + this.state.orangeTimer} ></BoxView>
<BoxView color="orange" darkcolor="#806300" timer={this.state.orangeTimer } delay={this.state.greenTimer} ></BoxView>
<BoxView color="lawngreen" darkcolor="darkgreen" timer={this.state.greenTimer } delay={0} ></BoxView>
</View>
<View style={{ flex:.1, backgroundColor: 'silver'}} >
<Text>knoppen</Text>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});