|
@@ -58,8 +58,8 @@ class FirstTabScreen extends Component {
|
58
|
58
|
Alert.alert('NavBar', 'Add button pressed');
|
59
|
59
|
break;
|
60
|
60
|
|
61
|
|
- case 'selectedTabChanged':
|
62
|
|
- this.onTabSelected(event.position);
|
|
61
|
+ case 'tabSelected':
|
|
62
|
+ this.onTabSelected();
|
63
|
63
|
break;
|
64
|
64
|
|
65
|
65
|
default:
|
|
@@ -95,38 +95,16 @@ class FirstTabScreen extends Component {
|
95
|
95
|
}
|
96
|
96
|
});
|
97
|
97
|
}
|
98
|
|
- return;
|
99
|
98
|
}
|
100
|
99
|
|
101
|
|
- onTabSelected(position) {
|
102
|
|
- console.log('selectedTabChanged ' + position);
|
103
|
|
- let rightButtons;
|
104
|
|
-
|
105
|
|
- switch (position) {
|
106
|
|
- case 0:
|
107
|
|
- rightButtons = [
|
108
|
|
- {
|
109
|
|
- id: 'account',
|
110
|
|
- icon: require('../../img/ic_account_box_.png')
|
111
|
|
- }
|
112
|
|
- ];
|
113
|
|
- break;
|
114
|
|
-
|
115
|
|
- case 1:
|
116
|
|
- rightButtons = [
|
117
|
|
- {
|
118
|
|
- id: 'account',
|
119
|
|
- icon: require('../../img/ic_add_alert.png')
|
120
|
|
- }
|
121
|
|
- ];
|
122
|
|
- break;
|
123
|
|
-
|
124
|
|
- default:
|
125
|
|
- rightButtons = [];
|
126
|
|
- break;
|
127
|
|
- }
|
128
|
|
-
|
129
|
|
- this.props.navigator.setButtons({rightButtons});
|
|
100
|
+ onTabSelected() {
|
|
101
|
+ console.log('selectedTabChanged');
|
|
102
|
+ this.props.navigator.setButtons({rightButtons: [
|
|
103
|
+ {
|
|
104
|
+ id: 'account',
|
|
105
|
+ icon: require('../../img/ic_account_box_.png')
|
|
106
|
+ }
|
|
107
|
+ ]});
|
130
|
108
|
}
|
131
|
109
|
|
132
|
110
|
render() {
|
|
@@ -165,6 +143,10 @@ class FirstTabScreen extends Component {
|
165
|
143
|
<Text style={styles.button}>Set Two Buttons</Text>
|
166
|
144
|
</TouchableOpacity>
|
167
|
145
|
|
|
146
|
+ <TouchableOpacity onPress={ this.onToggleDrawerPress.bind(this) }>
|
|
147
|
+ <Text style={styles.button}>Toggle Drawer</Text>
|
|
148
|
+ </TouchableOpacity>
|
|
149
|
+
|
168
|
150
|
<Text style={{fontWeight: '500'}}>String prop: {this.props.str}</Text>
|
169
|
151
|
<Text style={{fontWeight: '500'}}>Function prop: {this.props.fn ? this.props.fn() : ''}</Text>
|
170
|
152
|
{this.props.obj ? <Text style={{fontWeight: '500'}}>Object prop: {this.props.obj.str}</Text> : false}
|
|
@@ -259,6 +241,13 @@ class FirstTabScreen extends Component {
|
259
|
241
|
]
|
260
|
242
|
})
|
261
|
243
|
}
|
|
244
|
+
|
|
245
|
+ onToggleDrawerPress() {
|
|
246
|
+ this.props.navigator.toggleDrawer({
|
|
247
|
+ side: 'left',
|
|
248
|
+ animated: true
|
|
249
|
+ })
|
|
250
|
+ }
|
262
|
251
|
}
|
263
|
252
|
|
264
|
253
|
const styles = StyleSheet.create({
|