Browse Source

Support titleImage

Artal Druk 8 years ago
parent
commit
640773c374
4 changed files with 30 additions and 0 deletions
  1. 5
    0
      .gitignore
  2. 11
    0
      example/src/screens/ThirdTabScreen.js
  3. 4
    0
      src/Screen.js
  4. 10
    0
      src/platformSpecific.ios.js

+ 5
- 0
.gitignore View File

136
 *.gcda
136
 *.gcda
137
 *.gcno
137
 *.gcno
138
 
138
 
139
+####
140
+# Webstrom
141
+
142
+.idea
143
+
139
 ####
144
 ####
140
 # UNKNOWN: recommended by others, but I can't discover what these files are
145
 # UNKNOWN: recommended by others, but I can't discover what these files are
141
 #
146
 #

+ 11
- 0
example/src/screens/ThirdTabScreen.js View File

26
           <Text style={styles.button}>Push Styled Screen</Text>
26
           <Text style={styles.button}>Push Styled Screen</Text>
27
         </TouchableOpacity>
27
         </TouchableOpacity>
28
 
28
 
29
+        <TouchableOpacity onPress={ this.onPushStyled2Press.bind(this) }>
30
+          <Text style={styles.button}>Push Styled Screen 2</Text>
31
+        </TouchableOpacity>
32
+
29
         <TouchableOpacity onPress={ this.onModalPress.bind(this) }>
33
         <TouchableOpacity onPress={ this.onModalPress.bind(this) }>
30
           <Text style={styles.button}>Show Modal Screen</Text>
34
           <Text style={styles.button}>Show Modal Screen</Text>
31
         </TouchableOpacity>
35
         </TouchableOpacity>
45
       screen: "example.StyledScreen"
49
       screen: "example.StyledScreen"
46
     });
50
     });
47
   }
51
   }
52
+  onPushStyled2Press () {
53
+    this.props.navigator.push({
54
+      title: "Styled",
55
+      titleImage: require('../../img/two.png'),
56
+      screen: "example.StyledScreen"
57
+    });
58
+  }
48
   onModalPress() {
59
   onModalPress() {
49
     this.props.navigator.showModal({
60
     this.props.navigator.showModal({
50
       title: "Modal",
61
       title: "Modal",

+ 4
- 0
src/Screen.js View File

61
     return platformSpecific.navigatorSetTitle(this, params);
61
     return platformSpecific.navigatorSetTitle(this, params);
62
   }
62
   }
63
 
63
 
64
+  setTitleImage(params = {}) {
65
+    return platformSpecific.navigatorSetTitleImage(this, params);
66
+  }
67
+
64
   toggleDrawer(params = {}) {
68
   toggleDrawer(params = {}) {
65
     return platformSpecific.navigatorToggleDrawer(this, params);
69
     return platformSpecific.navigatorToggleDrawer(this, params);
66
   }
70
   }

+ 10
- 0
src/platformSpecific.ios.js View File

183
   passProps.navigatorEventID = navigatorEventID;
183
   passProps.navigatorEventID = navigatorEventID;
184
   Controllers.NavigationControllerIOS(navigator.navigatorID).push({
184
   Controllers.NavigationControllerIOS(navigator.navigatorID).push({
185
     title: params.title,
185
     title: params.title,
186
+    titleImage: params.titleImage,
186
     component: params.screen,
187
     component: params.screen,
187
     animated: params.animated,
188
     animated: params.animated,
188
     passProps: passProps,
189
     passProps: passProps,
223
   passProps.navigatorEventID = navigatorEventID;
224
   passProps.navigatorEventID = navigatorEventID;
224
   Controllers.NavigationControllerIOS(navigator.navigatorID).resetTo({
225
   Controllers.NavigationControllerIOS(navigator.navigatorID).resetTo({
225
     title: params.title,
226
     title: params.title,
227
+    titleImage: params.titleImage,
226
     component: params.screen,
228
     component: params.screen,
227
     animated: params.animated,
229
     animated: params.animated,
228
     passProps: passProps,
230
     passProps: passProps,
238
   });
240
   });
239
 }
241
 }
240
 
242
 
243
+function navigatorSetTitleImage
244
+(navigator, params) {
245
+  Controllers.NavigationControllerIOS(navigator.navigatorID).setTitleImage({
246
+    titleImage: params.titleImage
247
+  });
248
+}
249
+
241
 function navigatorToggleDrawer(navigator, params) {
250
 function navigatorToggleDrawer(navigator, params) {
242
   const controllerID = navigator.navigatorID.split('_')[0];
251
   const controllerID = navigator.navigatorID.split('_')[0];
243
   if (params.to == 'open') {
252
   if (params.to == 'open') {
399
   dismissLightBox,
408
   dismissLightBox,
400
   navigatorSetButtons,
409
   navigatorSetButtons,
401
   navigatorSetTitle,
410
   navigatorSetTitle,
411
+  navigatorSetTitleImage,
402
   navigatorToggleDrawer,
412
   navigatorToggleDrawer,
403
   navigatorToggleTabs,
413
   navigatorToggleTabs,
404
   navigatorSetTabBadge,
414
   navigatorSetTabBadge,