|
@@ -4,7 +4,8 @@ import React, {
|
4
|
4
|
View,
|
5
|
5
|
ScrollView,
|
6
|
6
|
TouchableOpacity,
|
7
|
|
- StyleSheet
|
|
7
|
+ StyleSheet,
|
|
8
|
+ TextInput
|
8
|
9
|
} from 'react-native';
|
9
|
10
|
import { connect } from 'react-redux';
|
10
|
11
|
import * as counterActions from '../reducers/counter/actions';
|
|
@@ -13,10 +14,22 @@ import * as counterActions from '../reducers/counter/actions';
|
13
|
14
|
class PushedScreen extends Component {
|
14
|
15
|
constructor(props) {
|
15
|
16
|
super(props);
|
|
17
|
+ this.bgColor = this.getRandomColor();
|
|
18
|
+ console.log('constructor');
|
16
|
19
|
}
|
|
20
|
+
|
|
21
|
+ getRandomColor() {
|
|
22
|
+ var letters = '0123456789ABCDEF'.split('');
|
|
23
|
+ var color = '#';
|
|
24
|
+ for (var i = 0; i < 6; i++ ) {
|
|
25
|
+ color += letters[Math.floor(Math.random() * 16)];
|
|
26
|
+ }
|
|
27
|
+ return color;
|
|
28
|
+ }
|
|
29
|
+
|
17
|
30
|
render() {
|
18
|
31
|
return (
|
19
|
|
- <View style={{flex: 1, padding: 20}}>
|
|
32
|
+ <View style={{flex: 1, padding: 20, backgroundColor: this.bgColor}}>
|
20
|
33
|
|
21
|
34
|
<Text style={styles.text}>
|
22
|
35
|
<Text style={{fontWeight: '500'}}>Counter: </Text> {this.props.counter.count}
|
|
@@ -34,6 +47,8 @@ class PushedScreen extends Component {
|
34
|
47
|
<Text style={styles.button}>Pop Screen</Text>
|
35
|
48
|
</TouchableOpacity>
|
36
|
49
|
|
|
50
|
+ <TextInput style={{height: 40, borderColor: 'gray', borderWidth: 1}}/>
|
|
51
|
+
|
37
|
52
|
</View>
|
38
|
53
|
);
|
39
|
54
|
}
|