-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.android.js
More file actions
81 lines (72 loc) · 2.09 KB
/
index.android.js
File metadata and controls
81 lines (72 loc) · 2.09 KB
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
import React, {
AppRegistry,
Component,
StyleSheet,
processColor,
Text,
View,
TouchableHighlight,
} from 'react-native';
import ToastAndroid from './ToastAndroid';
import NativeLinearGradient from './NativeLinearGradient';
import ColorSeekbarNative from './ColorSeekbarNative';
var incrementColor = require('./incrementColor');
class ReactNativeExample extends Component {
constructor(props) {
super(props);
this.state= {
count: 0,
colorTop: '#000000',
colorBottom: '#cccccc',
};
}
componentDidMount() {
setInterval(() => {
this.setState({
count: this.state.count + 1,
colorTop: incrementColor(this.state.colorTop, 1),
colorBottom: incrementColor(this.state.colorBottom, -1),
});
}, 20);
}
showToast() {
ToastAndroid.show('Awesome', ToastAndroid.SHORT);
}
render() {
return (
<View style={styles.container}>
<TouchableHighlight underlayColor={this.state.colorTop} style={{backgroundColor: this.state.colorBottom, padding: 10}}
onPress={this.showToast.bind(this)}>
<Text>Click Me</Text>
</TouchableHighlight>
<View>
<NativeLinearGradient
onClick={this.showToast.bind(this)}
colors={[this.state.colorTop, this.state.colorBottom]}
style={styles.gradient} />
<Text style={{color: this.state.colorTop}}>{this.state.colorTop}</Text>
<Text style={{color: this.state.colorBottom}}>{this.state.colorBottom}</Text>
</View>
<ColorSeekbarNative color={this.state.colorTop} style={styles.seekbar}/>
</View>
);
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'space-around',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
gradient: {
width: 200,
height: 200,
},
seekbar: {
alignItems: 'center',
justifyContent: 'center',
height: 120,
},
});
AppRegistry.registerComponent('ReactNativeExample', () => ReactNativeExample);