Browse Source

root with depth fix

yogevbd 6 years ago
parent
commit
24dfb69bd9
No account linked to committer's email address

+ 1
- 1
ios/RCCNavigationController.m View File

@@ -94,7 +94,7 @@ NSString const *CALLBACK_ASSOCIATED_ID = @"RCCNavigationController.CALLBACK_ASSO
94 94
     NSMutableDictionary *passProps = [actionParams[@"passProps"] mutableCopy];
95 95
     passProps[GLOBAL_SCREEN_ACTION_COMMAND_TYPE] = COMMAND_TYPE_PUSH;
96 96
     passProps[GLOBAL_SCREEN_ACTION_TIMESTAMP] = actionParams[GLOBAL_SCREEN_ACTION_TIMESTAMP];
97
-    NSDictionary *navigatorStyle = actionParams[@"style"];
97
+    NSDictionary *navigatorStyle = actionParams[@"style"] ? actionParams[@"style"] : actionParams[@"navigatorStyle"];
98 98
     
99 99
     NSNumber *keepStyleAcrossPush = [[RCCManager sharedInstance] getAppStyle][@"keepStyleAcrossPush"];
100 100
     BOOL keepStyleAcrossPushBool = keepStyleAcrossPush ? [keepStyleAcrossPush boolValue] : YES;

+ 10
- 0
src/deprecated/controllers/index.js View File

@@ -102,6 +102,15 @@ var Controllers = {
102 102
           props['style'] = Object.assign({}, props['style']);
103 103
           _processProperties(props['style']);
104 104
         }
105
+
106
+        if (props['components']) {
107
+          props['components'].forEach(component => {
108
+            if (component['navigatorStyle']) {
109
+              component['navigatorStyle'] = Object.assign({}, component['navigatorStyle']);
110
+              _processProperties(component['navigatorStyle']);
111
+            }
112
+          });
113
+        }
105 114
         return {
106 115
           'type': type.name,
107 116
           'props': props,
@@ -126,6 +135,7 @@ var Controllers = {
126 135
       if (controller === undefined) return;
127 136
       var layout = controller.render();
128 137
       _validateDrawerProps(layout);
138
+      console.log('set root');
129 139
       _processProperties(_.get(layout, 'props.appStyle', {}));
130 140
       return await RCCManager.setRootController(layout, animationType, passProps);
131 141
     },

+ 42
- 15
src/deprecated/platformSpecificDeprecated.ios.js View File

@@ -1,6 +1,6 @@
1 1
 /*eslint-disable*/
2
-import { Component } from 'react';
3
-import { findNodeHandle } from 'react-native';
2
+import {Component} from 'react';
3
+import {findNodeHandle} from 'react-native';
4 4
 import Navigation from './../Navigation';
5 5
 import Controllers, {Modal, Notification, ScreenUtils} from './controllers';
6 6
 const React = Controllers.hijackReact();
@@ -21,7 +21,7 @@ async function startTabBasedApp(params) {
21 21
   }
22 22
 
23 23
   const controllerID = _.uniqueId('controllerID');
24
-  params.tabs.map(function(tab, index) {
24
+  params.tabs.map(function (tab, index) {
25 25
     const navigatorID = controllerID + '_nav' + index;
26 26
     const screenInstanceID = _.uniqueId('screenInstanceID');
27 27
 
@@ -54,7 +54,7 @@ async function startTabBasedApp(params) {
54 54
   });
55 55
 
56 56
   const Controller = Controllers.createClass({
57
-    render: function() {
57
+    render: function () {
58 58
       if (!params.drawer || (!params.drawer.left && !params.drawer.right)) {
59 59
         return this.renderBody();
60 60
       } else {
@@ -63,11 +63,11 @@ async function startTabBasedApp(params) {
63 63
         const leftScreenId = _.uniqueId('screenInstanceID');
64 64
         const rightScreenId = _.uniqueId('screenInstanceID')
65 65
 
66
-        const { navigatorStyle: leftNavigatorStyle } = params.drawer.left
66
+        const {navigatorStyle: leftNavigatorStyle} = params.drawer.left
67 67
           ? _mergeScreenSpecificSettings(params.drawer.left.screen, leftScreenId, params.drawer.left)
68 68
           : {};
69 69
 
70
-        const { navigatorStyle: rightNavigatorStyle } = params.drawer.right
70
+        const {navigatorStyle: rightNavigatorStyle} = params.drawer.right
71 71
           ? _mergeScreenSpecificSettings(params.drawer.right.screen, rightScreenId, params.drawer.right)
72 72
           : {};
73 73
 
@@ -140,25 +140,52 @@ async function startSingleScreenApp(params) {
140 140
     return;
141 141
   }
142 142
 
143
+  const controllerID = _.uniqueId('controllerID');
144
+  const navigatorID = controllerID + '_nav';
145
+
143 146
   if (components) {
147
+    screen = components[0];
148
+    components.shift();
149
+
144 150
     components.forEach(component => {
145
-      screen = components[0];
146
-      components.shift();
147 151
       const screenInstanceID = _.uniqueId('screenInstanceID');
152
+
153
+      const {
154
+        navigatorStyle,
155
+        navigatorButtons,
156
+        navigatorEventID
157
+      } = _mergeScreenSpecificSettings(component.screen, screenInstanceID, params);
158
+      _saveNavigatorButtonsProps(navigatorButtons);
159
+      _saveNavBarComponentProps(navigatorStyle);
160
+      const passProps = Object.assign({}, params.passProps);
161
+      passProps.navigatorID = navigatorID;
162
+      passProps.screenInstanceID = screenInstanceID;
163
+      passProps.navigatorEventID = navigatorEventID;
164
+
165
+
148 166
       component.navigationParams = {
149
-        screenInstanceID
167
+        screenInstanceID,
168
+        navigatorStyle,
169
+        navigatorButtons,
170
+        navigatorEventID,
171
+        navigatorID: navigatorID,
172
+        passProps
150 173
       };
174
+
175
+      component.subtitle = params.subtitle;
176
+      component.passProps = passProps;
177
+
151 178
       savePassProps(component);
179
+
152 180
     });
153 181
   }
154 182
 
155
-  const controllerID = _.uniqueId('controllerID');
156 183
   if (!screen.screen) {
157 184
     console.error('startSingleScreenApp(params): screen must include a screen property');
158 185
     return;
159 186
   }
160 187
 
161
-  const navigatorID = controllerID + '_nav';
188
+
162 189
   const screenInstanceID = _.uniqueId('screenInstanceID');
163 190
   const {
164 191
     navigatorStyle,
@@ -183,7 +210,7 @@ async function startSingleScreenApp(params) {
183 210
   };
184 211
 
185 212
   const Controller = Controllers.createClass({
186
-    render: function() {
213
+    render: function () {
187 214
       if (!params.drawer || (!params.drawer.left && !params.drawer.right)) {
188 215
         return this.renderBody();
189 216
       } else {
@@ -205,7 +232,7 @@ async function startSingleScreenApp(params) {
205 232
         );
206 233
       }
207 234
     },
208
-    renderBody: function() {
235
+    renderBody: function () {
209 236
       return (
210 237
         <NavigationControllerIOS
211 238
           id={navigatorID}
@@ -544,7 +571,7 @@ function showModal(params) {
544 571
   };
545 572
 
546 573
   const Controller = Controllers.createClass({
547
-    render: function() {
574
+    render: function () {
548 575
       return (
549 576
         <NavigationControllerIOS
550 577
           id={navigatorID}
@@ -555,7 +582,7 @@ function showModal(params) {
555 582
           passProps={passProps}
556 583
           style={navigatorStyle}
557 584
           leftButtons={navigatorButtons.leftButtons}
558
-          rightButtons={navigatorButtons.rightButtons}/>
585
+          rightButtons={navigatorButtons.rightButtons} />
559 586
       );
560 587
     }
561 588
   });