|
@@ -23,6 +23,7 @@ class SecondTabScreen extends Component {
|
23
|
23
|
super(props);
|
24
|
24
|
this.buttonsCounter = 0;
|
25
|
25
|
}
|
|
26
|
+
|
26
|
27
|
render() {
|
27
|
28
|
return (
|
28
|
29
|
<ScrollView style={{flex: 1}}>
|
|
@@ -44,14 +45,50 @@ class SecondTabScreen extends Component {
|
44
|
45
|
<Text style={{fontWeight: '500'}}>Object prop: {this.props.obj.str}</Text>
|
45
|
46
|
<Text style={{fontWeight: '500'}}>Array prop: {this.props.obj.arr[0].str}</Text>
|
46
|
47
|
|
|
48
|
+ <TouchableOpacity onPress={ this.onSetButton.bind(this) }>
|
|
49
|
+ <Text style={styles.button}>Set a button</Text>
|
|
50
|
+ </TouchableOpacity>
|
|
51
|
+
|
47
|
52
|
</View>
|
48
|
53
|
|
49
|
54
|
</ScrollView>
|
50
|
55
|
);
|
51
|
56
|
}
|
|
57
|
+
|
52
|
58
|
onIncrementPress() {
|
53
|
59
|
this.props.dispatch(counterActions.increment());
|
54
|
60
|
}
|
|
61
|
+
|
|
62
|
+ onSetButton() {
|
|
63
|
+ this.props.navigator.setButtons({
|
|
64
|
+ rightButtons: [
|
|
65
|
+ {
|
|
66
|
+ title: 'Right',
|
|
67
|
+ icon: require('../../img/navicon_add.png'),
|
|
68
|
+ id: 'right'
|
|
69
|
+ }
|
|
70
|
+ ],
|
|
71
|
+ leftButtons: [
|
|
72
|
+ {
|
|
73
|
+ title: 'Left',
|
|
74
|
+ icon: require('../../img/navicon_add.png'),
|
|
75
|
+ id: 'left'
|
|
76
|
+ }
|
|
77
|
+ ]
|
|
78
|
+ });
|
|
79
|
+ this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
|
|
80
|
+ }
|
|
81
|
+
|
|
82
|
+ onNavigatorEvent(event) {
|
|
83
|
+ switch (event.id) {
|
|
84
|
+ case 'left':
|
|
85
|
+ Alert.alert('NavBar', 'Left button pressed');
|
|
86
|
+ break;
|
|
87
|
+ case 'right':
|
|
88
|
+ Alert.alert('NavBar', 'Right button pressed');
|
|
89
|
+ break;
|
|
90
|
+ }
|
|
91
|
+ }
|
55
|
92
|
}
|
56
|
93
|
|
57
|
94
|
const styles = StyleSheet.create({
|