Explorar el Código

deep stack for startTabBasedApp and startSingleScreenApp (#2770)

yogevbd hace 7 años
padre
commit
97d62f9c34

+ 7
- 0
ios/RCCNavigationController.m Ver fichero

68
 
68
 
69
   [self setRotation:props];
69
   [self setRotation:props];
70
   
70
   
71
+  NSArray* components = props[@"components"];
72
+  if (components.count) {
73
+    for (NSDictionary* component in components) {
74
+      [self performAction:@"push" actionParams:@{@"animated": @(0), @"component": component[@"screen"]} bridge:bridge];
75
+    }
76
+  }
77
+  
71
   return self;
78
   return self;
72
 }
79
 }
73
 
80
 

+ 20
- 3
src/deprecated/platformSpecificDeprecated.ios.js Ver fichero

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
-    if (!tab.screen) {
27
+
28
+    const components = tab.components;
29
+    if (!tab.screen && !components) {
28
       console.error('startTabBasedApp(params): every tab must include a screen property, take a look at tab#' + (index + 1));
30
       console.error('startTabBasedApp(params): every tab must include a screen property, take a look at tab#' + (index + 1));
29
       return;
31
       return;
30
     }
32
     }
33
+
34
+    if (components) {
35
+      params.tabs[index].components = components;
36
+      Object.assign(tab, components[0]);
37
+      components.shift();
38
+    }
39
+    
31
     const {
40
     const {
32
       navigatorStyle,
41
       navigatorStyle,
33
       navigatorButtons,
42
       navigatorButtons,
98
                     subtitle={tab.subtitle}
107
                     subtitle={tab.subtitle}
99
                     titleImage={tab.titleImage}
108
                     titleImage={tab.titleImage}
100
                     component={tab.screen}
109
                     component={tab.screen}
110
+                    components={tab.components}
101
                     passProps={{
111
                     passProps={{
102
                     navigatorID: tab.navigationParams.navigatorID,
112
                     navigatorID: tab.navigationParams.navigatorID,
103
                     screenInstanceID: tab.navigationParams.screenInstanceID,
113
                     screenInstanceID: tab.navigationParams.screenInstanceID,
123
 }
133
 }
124
 
134
 
125
 async function startSingleScreenApp(params) {
135
 async function startSingleScreenApp(params) {
126
-  if (!params.screen) {
136
+  const components = params.components;
137
+  let screen = params.screen;
138
+  if (!screen && !components) {
127
     console.error('startSingleScreenApp(params): params.screen is required');
139
     console.error('startSingleScreenApp(params): params.screen is required');
128
     return;
140
     return;
129
   }
141
   }
130
 
142
 
143
+  if (components) {
144
+    screen = components[0];
145
+    components.shift();
146
+  }
147
+
131
   const controllerID = _.uniqueId('controllerID');
148
   const controllerID = _.uniqueId('controllerID');
132
-  const screen = params.screen;
133
   if (!screen.screen) {
149
   if (!screen.screen) {
134
     console.error('startSingleScreenApp(params): screen must include a screen property');
150
     console.error('startSingleScreenApp(params): screen must include a screen property');
135
     return;
151
     return;
183
           subtitle={params.subtitle}
199
           subtitle={params.subtitle}
184
           titleImage={screen.titleImage}
200
           titleImage={screen.titleImage}
185
           component={screen.screen}
201
           component={screen.screen}
202
+          components={components}
186
           passProps={{
203
           passProps={{
187
             navigatorID: navigatorID,
204
             navigatorID: navigatorID,
188
             screenInstanceID: screenInstanceID,
205
             screenInstanceID: screenInstanceID,