Browse Source

Add setSubtitle example

Guy Carmeli 8 years ago
parent
commit
56b34d0bb6
1 changed files with 69 additions and 55 deletions
  1. 69
    55
      example-redux/src/screens/FirstTabScreen.js

+ 69
- 55
example-redux/src/screens/FirstTabScreen.js View File

@@ -110,60 +110,66 @@ class FirstTabScreen extends Component {
110 110
 
111 111
   render() {
112 112
     return (
113
-      <View style={{flex: 1, padding: 20}}>
114
-
115
-        <Text style={styles.text}>
116
-          <Text style={{fontWeight: '500'}}>Same Counter: </Text> {this.props.counter.count}
117
-        </Text>
118
-
119
-        <TouchableOpacity onPress={ this.onIncrementPress.bind(this) }>
120
-          <Text style={styles.button}>Increment Counter</Text>
121
-        </TouchableOpacity>
122
-
123
-        <TouchableOpacity onPress={ this.onPushPress.bind(this) }>
124
-          <Text style={styles.button}>Push Screen</Text>
125
-        </TouchableOpacity>
126
-
127
-        <TouchableOpacity onPress={ this.onShowModalPress.bind(this) }>
128
-          <Text style={styles.button}>Modal Screen</Text>
129
-        </TouchableOpacity>
130
-
131
-        <TouchableOpacity onPress={ this.onToggleNavBarPress.bind(this) }>
132
-          <Text style={styles.button}>Toggle NavBar</Text>
133
-        </TouchableOpacity>
134
-
135
-        {
136
-          Platform.OS === 'android' ?
137
-          <TouchableOpacity onPress={ this.onShowSnackbarPress.bind(this) }>
138
-            <Text style={styles.button}>Show Snackbar</Text>
139
-          </TouchableOpacity> : false
140
-        }
141
-
142
-        <TouchableOpacity onPress={ this.onSetTitlePress.bind(this) }>
143
-          <Text style={styles.button}>Set Title</Text>
144
-        </TouchableOpacity>
145
-
146
-        <TouchableOpacity onPress={ this.onSetOneButtonsPress.bind(this) }>
147
-          <Text style={styles.button}>Set One Buttons</Text>
148
-        </TouchableOpacity>
149
-
150
-        <TouchableOpacity onPress={ this.onSetTwoButtonsPress.bind(this) }>
151
-          <Text style={styles.button}>Set Two Buttons</Text>
152
-        </TouchableOpacity>
153
-
154
-        <TouchableOpacity onPress={ this.onToggleDrawerPress.bind(this) }>
155
-          <Text style={styles.button}>Toggle Drawer</Text>
156
-        </TouchableOpacity>
157
-
158
-        <TouchableOpacity onPress={ this.onSelectSecondTabPress.bind(this) }>
159
-          <Text style={styles.button}>Select Second Tab</Text>
160
-        </TouchableOpacity>
161
-
162
-        <Text style={{fontWeight: '500'}}>String prop: {this.props.str}</Text>
163
-        <Text style={{fontWeight: '500'}}>Function prop: {this.props.fn ? this.props.fn() : ''}</Text>
164
-        {this.props.obj ? <Text style={{fontWeight: '500'}}>Object prop: {this.props.obj.str}</Text> : false}
165
-        {this.props.obj && this.props.obj.arr ? <Text style={{fontWeight: '500'}}>Array prop: {this.props.obj.arr[0].str}</Text> : false}
166
-      </View>
113
+      <ScrollView>
114
+        <View style={{flex: 1, padding: 20}}>
115
+
116
+          <Text style={styles.text}>
117
+            <Text style={{fontWeight: '500'}}>Same Counter: </Text> {this.props.counter.count}
118
+          </Text>
119
+
120
+          <TouchableOpacity onPress={ this.onIncrementPress.bind(this) }>
121
+            <Text style={styles.button}>Increment Counter</Text>
122
+          </TouchableOpacity>
123
+
124
+          <TouchableOpacity onPress={ this.onPushPress.bind(this) }>
125
+            <Text style={styles.button}>Push Screen</Text>
126
+          </TouchableOpacity>
127
+
128
+          <TouchableOpacity onPress={ this.onShowModalPress.bind(this) }>
129
+            <Text style={styles.button}>Modal Screen</Text>
130
+          </TouchableOpacity>
131
+
132
+          <TouchableOpacity onPress={ this.onToggleNavBarPress.bind(this) }>
133
+            <Text style={styles.button}>Toggle NavBar</Text>
134
+          </TouchableOpacity>
135
+
136
+          {
137
+            Platform.OS === 'android' ?
138
+            <TouchableOpacity onPress={ this.onShowSnackbarPress.bind(this) }>
139
+              <Text style={styles.button}>Show Snackbar</Text>
140
+            </TouchableOpacity> : false
141
+          }
142
+
143
+          <TouchableOpacity onPress={ this.onSetTitlePress.bind(this) }>
144
+            <Text style={styles.button}>Set Title</Text>
145
+          </TouchableOpacity>
146
+
147
+          <TouchableOpacity onPress={ this.onSetSubtitlePress.bind(this) }>
148
+            <Text style={styles.button}>Set Subtitle</Text>
149
+          </TouchableOpacity>
150
+
151
+          <TouchableOpacity onPress={ this.onSetOneButtonsPress.bind(this) }>
152
+            <Text style={styles.button}>Set One Buttons</Text>
153
+          </TouchableOpacity>
154
+
155
+          <TouchableOpacity onPress={ this.onSetTwoButtonsPress.bind(this) }>
156
+            <Text style={styles.button}>Set Two Buttons</Text>
157
+          </TouchableOpacity>
158
+
159
+          <TouchableOpacity onPress={ this.onToggleDrawerPress.bind(this) }>
160
+            <Text style={styles.button}>Toggle Drawer</Text>
161
+          </TouchableOpacity>
162
+
163
+          <TouchableOpacity onPress={ this.onSelectSecondTabPress.bind(this) }>
164
+            <Text style={styles.button}>Select Second Tab</Text>
165
+          </TouchableOpacity>
166
+
167
+          <Text style={{fontWeight: '500'}}>String prop: {this.props.str}</Text>
168
+          <Text style={{fontWeight: '500'}}>Function prop: {this.props.fn ? this.props.fn() : ''}</Text>
169
+          {this.props.obj ? <Text style={{fontWeight: '500'}}>Object prop: {this.props.obj.str}</Text> : false}
170
+          {this.props.obj && this.props.obj.arr ? <Text style={{fontWeight: '500'}}>Array prop: {this.props.obj.arr[0].str}</Text> : false}
171
+        </View>
172
+      </ScrollView>
167 173
     );
168 174
   }
169 175
 
@@ -229,7 +235,15 @@ class FirstTabScreen extends Component {
229 235
   }
230 236
 
231 237
   onSetTitlePress() {
232
-    this.props.navigator.setTitle(_.random(0, 100).toString());
238
+    this.props.navigator.setTitle({
239
+      title: 'Title ' + _.random(0, 100).toString()
240
+    });
241
+  }
242
+
243
+  onSetSubtitlePress() {
244
+    this.props.navigator.setSubTitle({
245
+      subtitle: 'Subtitle ' + _.random(0, 100).toString()
246
+    });
233 247
   }
234 248
 
235 249
   onSetOneButtonsPress() {