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
     NSMutableDictionary *passProps = [actionParams[@"passProps"] mutableCopy];
94
     NSMutableDictionary *passProps = [actionParams[@"passProps"] mutableCopy];
95
     passProps[GLOBAL_SCREEN_ACTION_COMMAND_TYPE] = COMMAND_TYPE_PUSH;
95
     passProps[GLOBAL_SCREEN_ACTION_COMMAND_TYPE] = COMMAND_TYPE_PUSH;
96
     passProps[GLOBAL_SCREEN_ACTION_TIMESTAMP] = actionParams[GLOBAL_SCREEN_ACTION_TIMESTAMP];
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
     NSNumber *keepStyleAcrossPush = [[RCCManager sharedInstance] getAppStyle][@"keepStyleAcrossPush"];
99
     NSNumber *keepStyleAcrossPush = [[RCCManager sharedInstance] getAppStyle][@"keepStyleAcrossPush"];
100
     BOOL keepStyleAcrossPushBool = keepStyleAcrossPush ? [keepStyleAcrossPush boolValue] : YES;
100
     BOOL keepStyleAcrossPushBool = keepStyleAcrossPush ? [keepStyleAcrossPush boolValue] : YES;

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

102
           props['style'] = Object.assign({}, props['style']);
102
           props['style'] = Object.assign({}, props['style']);
103
           _processProperties(props['style']);
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
         return {
114
         return {
106
           'type': type.name,
115
           'type': type.name,
107
           'props': props,
116
           'props': props,
126
       if (controller === undefined) return;
135
       if (controller === undefined) return;
127
       var layout = controller.render();
136
       var layout = controller.render();
128
       _validateDrawerProps(layout);
137
       _validateDrawerProps(layout);
138
+      console.log('set root');
129
       _processProperties(_.get(layout, 'props.appStyle', {}));
139
       _processProperties(_.get(layout, 'props.appStyle', {}));
130
       return await RCCManager.setRootController(layout, animationType, passProps);
140
       return await RCCManager.setRootController(layout, animationType, passProps);
131
     },
141
     },

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

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