From 5b465ab3ccc032dcacfb5e57d1a4db1aaf3009c0 Mon Sep 17 00:00:00 2001 From: yogevbd Date: Thu, 22 Feb 2018 11:07:18 +0200 Subject: [PATCH] deep stack for startTabBasedApp and startSingleScreenApp --- ios/RCCNavigationController.m | 7 ++++++ .../platformSpecificDeprecated.ios.js | 23 ++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ios/RCCNavigationController.m b/ios/RCCNavigationController.m index 8c15f7a145b..eecf5251e1f 100755 --- a/ios/RCCNavigationController.m +++ b/ios/RCCNavigationController.m @@ -68,6 +68,13 @@ - (instancetype)initWithProps:(NSDictionary *)props children:(NSArray *)children [self setRotation:props]; + NSArray* components = props[@"components"]; + if (components.count) { + for (NSDictionary* component in components) { + [self performAction:@"push" actionParams:@{@"animated": @(0), @"component": component[@"screen"]} bridge:bridge]; + } + } + return self; } diff --git a/src/deprecated/platformSpecificDeprecated.ios.js b/src/deprecated/platformSpecificDeprecated.ios.js index 1c38b8ce5e0..beb7d6047ec 100644 --- a/src/deprecated/platformSpecificDeprecated.ios.js +++ b/src/deprecated/platformSpecificDeprecated.ios.js @@ -24,10 +24,19 @@ async function startTabBasedApp(params) { params.tabs.map(function(tab, index) { const navigatorID = controllerID + '_nav' + index; const screenInstanceID = _.uniqueId('screenInstanceID'); - if (!tab.screen) { + + const components = tab.components; + if (!tab.screen && !components) { console.error('startTabBasedApp(params): every tab must include a screen property, take a look at tab#' + (index + 1)); return; } + + if (components) { + params.tabs[index].components = components; + Object.assign(tab, components[0]); + components.shift(); + } + const { navigatorStyle, navigatorButtons, @@ -98,6 +107,7 @@ async function startTabBasedApp(params) { subtitle={tab.subtitle} titleImage={tab.titleImage} component={tab.screen} + components={tab.components} passProps={{ navigatorID: tab.navigationParams.navigatorID, screenInstanceID: tab.navigationParams.screenInstanceID, @@ -123,13 +133,19 @@ async function startTabBasedApp(params) { } async function startSingleScreenApp(params) { - if (!params.screen) { + const components = params.components; + let screen = params.screen; + if (!screen && !components) { console.error('startSingleScreenApp(params): params.screen is required'); return; } + if (components) { + screen = components[0]; + components.shift(); + } + const controllerID = _.uniqueId('controllerID'); - const screen = params.screen; if (!screen.screen) { console.error('startSingleScreenApp(params): screen must include a screen property'); return; @@ -183,6 +199,7 @@ async function startSingleScreenApp(params) { subtitle={params.subtitle} titleImage={screen.titleImage} component={screen.screen} + components={components} passProps={{ navigatorID: navigatorID, screenInstanceID: screenInstanceID,