Quellcode durchsuchen

add subtitle support to navigation bar

Ran Greenberg vor 7 Jahren
Ursprung
Commit
a425e9077a

+ 1
- 0
example/src/app.js Datei anzeigen

17
     navigatorStyle: {
17
     navigatorStyle: {
18
       navBarBackgroundColor: '#4dbce9',
18
       navBarBackgroundColor: '#4dbce9',
19
       navBarTextColor: '#ffff00',
19
       navBarTextColor: '#ffff00',
20
+      navBarSubtitleTextColor: '#ff0000',
20
       navBarButtonColor: '#ffffff',
21
       navBarButtonColor: '#ffffff',
21
       statusBarTextColorScheme: 'light'
22
       statusBarTextColorScheme: 'light'
22
     }
23
     }

+ 28
- 0
example/src/screens/StyledScreen.js Datei anzeigen

46
           <TouchableOpacity onPress={ this.onPopPress.bind(this) }>
46
           <TouchableOpacity onPress={ this.onPopPress.bind(this) }>
47
             <Text style={styles.button}>Pop Screen</Text>
47
             <Text style={styles.button}>Pop Screen</Text>
48
           </TouchableOpacity>
48
           </TouchableOpacity>
49
+  
50
+          <TouchableOpacity onPress={ this.onSetSubtitlePress.bind(this) }>
51
+            <Text style={styles.button}>Set Subtitle</Text>
52
+          </TouchableOpacity>
53
+  
54
+          <TouchableOpacity onPress={ this.onSetTitleImagePress.bind(this) }>
55
+            <Text style={styles.button}>Set Title Image</Text>
56
+          </TouchableOpacity>
49
 
57
 
50
         </View>
58
         </View>
51
 
59
 
72
   onPopPress() {
80
   onPopPress() {
73
     this.props.navigator.pop();
81
     this.props.navigator.pop();
74
   }
82
   }
83
+  
84
+  onSetSubtitlePress() {
85
+    this.props.navigator.setTitle({
86
+      title: 'title',
87
+      subtitle: 'subtitle',
88
+      navigatorStyle: {
89
+        navBarSubtitleTextColor: '#ff00ff',
90
+        navBarTextColor: '#ffff00'
91
+        
92
+      }
93
+    })
94
+  }
95
+  
96
+  onSetTitleImagePress() {
97
+    this.props.navigator.setTitle({
98
+      title: 'title',
99
+      titleImage: require('../../img/one.png'),
100
+    })
101
+  }
102
+  
75
 }
103
 }
76
 
104
 
77
 const styles = StyleSheet.create({
105
 const styles = StyleSheet.create({

+ 8
- 1
src/deprecated/platformSpecificDeprecated.ios.js Datei anzeigen

151
         <NavigationControllerIOS
151
         <NavigationControllerIOS
152
           id={navigatorID}
152
           id={navigatorID}
153
           title={screen.title}
153
           title={screen.title}
154
+          subtitle={params.subtitle}
154
           titleImage={screen.titleImage}
155
           titleImage={screen.titleImage}
155
           component={screen.screen}
156
           component={screen.screen}
156
           passProps={{
157
           passProps={{
228
 
229
 
229
   Controllers.NavigationControllerIOS(navigator.navigatorID).push({
230
   Controllers.NavigationControllerIOS(navigator.navigatorID).push({
230
     title: params.title,
231
     title: params.title,
232
+    subtitle:params.subtitle,
231
     titleImage: params.titleImage,
233
     titleImage: params.titleImage,
232
     component: params.screen,
234
     component: params.screen,
233
     animated: params.animated,
235
     animated: params.animated,
280
 
282
 
281
   Controllers.NavigationControllerIOS(navigator.navigatorID).resetTo({
283
   Controllers.NavigationControllerIOS(navigator.navigatorID).resetTo({
282
     title: params.title,
284
     title: params.title,
285
+    subtitle: params.subtitle,
283
     titleImage: params.titleImage,
286
     titleImage: params.titleImage,
284
     component: params.screen,
287
     component: params.screen,
285
     animated: params.animated,
288
     animated: params.animated,
292
 
295
 
293
 function navigatorSetTitle(navigator, params) {
296
 function navigatorSetTitle(navigator, params) {
294
   Controllers.NavigationControllerIOS(navigator.navigatorID).setTitle({
297
   Controllers.NavigationControllerIOS(navigator.navigatorID).setTitle({
295
-    title: params.title
298
+    title: params.title,
299
+    subtitle: params.subtitle,
300
+    titleImage: params.titleImage,
301
+    style: params.navigatorStyle
296
   });
302
   });
297
 }
303
 }
298
 
304
 
416
         <NavigationControllerIOS
422
         <NavigationControllerIOS
417
           id={navigatorID}
423
           id={navigatorID}
418
           title={params.title}
424
           title={params.title}
425
+          subtitle={params.title}
419
           titleImage={params.titleImage}
426
           titleImage={params.titleImage}
420
           component={params.screen}
427
           component={params.screen}
421
           passProps={passProps}
428
           passProps={passProps}