Browse Source

Add set buttons methods to FirstTabScreen

Guy Carmeli 8 years ago
parent
commit
62839bcca8

BIN
example-redux/img/ic_account_box_@1.5x.android.png View File


BIN
example-redux/img/ic_account_box_@1x.android.png View File


BIN
example-redux/img/ic_account_box_@1x.ios.png View File


BIN
example-redux/img/ic_account_box_@2x.android.png View File


BIN
example-redux/img/ic_account_box_@2x.ios.png View File


BIN
example-redux/img/ic_account_box_@3x.android.png View File


BIN
example-redux/img/ic_account_box_@3x.ios.png View File


BIN
example-redux/img/ic_account_box_@4x.android.png View File


BIN
example-redux/img/ic_add_alert@1.5x.android.png View File


BIN
example-redux/img/ic_add_alert@1x.android.png View File


BIN
example-redux/img/ic_add_alert@1x.ios.png View File


BIN
example-redux/img/ic_add_alert@2x.android.png View File


BIN
example-redux/img/ic_add_alert@2x.ios.png View File


BIN
example-redux/img/ic_add_alert@3x.android.png View File


BIN
example-redux/img/ic_add_alert@3x.ios.png View File


BIN
example-redux/img/ic_add_alert@4x.android.png View File


BIN
example-redux/img/ic_home@1.5x.android.png View File


BIN
example-redux/img/ic_home@1x.android.png View File


BIN
example-redux/img/ic_home@1x.ios.png View File


BIN
example-redux/img/ic_home@2x.android.png View File


BIN
example-redux/img/ic_home@2x.ios.png View File


BIN
example-redux/img/ic_home@3x.android.png View File


BIN
example-redux/img/ic_home@3x.ios.png View File


BIN
example-redux/img/ic_home@4x.android.png View File


+ 40
- 0
example-redux/src/screens/FirstTabScreen.js View File

@@ -88,6 +88,14 @@ class FirstTabScreen extends Component {
88 88
           <Text style={styles.button}>Set Title</Text>
89 89
         </TouchableOpacity>
90 90
 
91
+        <TouchableOpacity onPress={ this.onSetOneButtonsPress.bind(this) }>
92
+          <Text style={styles.button}>Set One Buttons</Text>
93
+        </TouchableOpacity>
94
+
95
+        <TouchableOpacity onPress={ this.onSetTwoButtonsPress.bind(this) }>
96
+          <Text style={styles.button}>Set Two Buttons</Text>
97
+        </TouchableOpacity>
98
+
91 99
         <Text style={{fontWeight: '500'}}>String prop: {this.props.str}</Text>
92 100
         <Text style={{fontWeight: '500'}}>Number prop: {this.props.num}</Text>
93 101
         <Text style={{fontWeight: '500'}}>Object prop: {this.props.obj.str}</Text>
@@ -149,6 +157,38 @@ class FirstTabScreen extends Component {
149 157
   onSetTitlePress() {
150 158
     this.props.navigator.setTitle(_.random(0, 100).toString());
151 159
   }
160
+
161
+  onSetOneButtonsPress() {
162
+    this.props.navigator.setButtons({
163
+      rightButtons: [
164
+        {
165
+          title: 'Account Box',
166
+          icon: require('../../img/ic_account_box_.png'),
167
+          id: 'accountBox'
168
+        }
169
+      ]
170
+    });
171
+  }
172
+
173
+  onSetTwoButtonsPress() {
174
+    this.props.navigator.setButtons({
175
+      rightButtons: [
176
+        {
177
+          title: 'Add Alert',
178
+          icon: require('../../img/ic_add_alert.png'),
179
+          id: 'addAlert',
180
+          color: '#F44336',
181
+          enabled: false
182
+        },
183
+        {
184
+          title: 'Home',
185
+          icon: require('../../img/ic_home.png'),
186
+          id: 'home',
187
+          color: '#9CCC65'
188
+        }
189
+      ]
190
+    })
191
+  }
152 192
 }
153 193
 
154 194
 const styles = StyleSheet.create({