Browse Source

Merge branch 'master' into getLaunchArgs

Daniel Zlotin 6 years ago
parent
commit
d05c0c76a8

+ 1
- 0
ios/RCCManager.h View File

@@ -13,6 +13,7 @@
13 13
 -(UIWindow*)getAppWindow;
14 14
 -(void)setAppStyle:(NSDictionary*)appStyle;
15 15
 -(NSDictionary*)getAppStyle;
16
+-(NSDictionary*)getInitialProps;
16 17
 
17 18
 -(void)registerController:(UIViewController*)controller componentId:(NSString*)componentId componentType:(NSString*)componentType;
18 19
 -(id)getControllerWithId:(NSString*)componentId componentType:(NSString*)componentType;

+ 6
- 0
ios/RCCManager.m View File

@@ -10,6 +10,7 @@
10 10
 @property (nonatomic, strong) RCTBridge *sharedBridge;
11 11
 @property (nonatomic, strong) NSURL *bundleURL;
12 12
 @property (nonatomic, strong, readwrite) NSDictionary *globalAppStyle;
13
+@property (nonatomic, strong) NSDictionary *launchOptions;
13 14
 @end
14 15
 
15 16
 @implementation RCCManager
@@ -46,6 +47,10 @@
46 47
   return self;
47 48
 }
48 49
 
50
+- (NSDictionary *)getInitialProps {
51
+  return _launchOptions;
52
+}
53
+
49 54
 -(void)clearModuleRegistry
50 55
 {
51 56
   [self.modulesRegistry removeAllObjects];
@@ -155,6 +160,7 @@
155 160
 {
156 161
   if (self.sharedBridge) return;
157 162
   
163
+  self.launchOptions = launchOptions;
158 164
   self.bundleURL = bundleURL;
159 165
   self.sharedBridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
160 166
   

+ 5
- 0
ios/RCCManagerModule.m View File

@@ -480,4 +480,9 @@ RCT_EXPORT_METHOD(
480 480
     [RCCManagerModule cancelAllRCCViewControllerReactTouches];
481 481
 }
482 482
 
483
+RCT_EXPORT_METHOD(getInitialProps:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
484
+{
485
+    resolve([[RCCManager sharedInstance] getInitialProps]);
486
+}
487
+
483 488
 @end

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

@@ -128,6 +128,9 @@ var Controllers = {
128 128
       _validateDrawerProps(layout);
129 129
       _processProperties(_.get(layout, 'props.appStyle', {}));
130 130
       return await RCCManager.setRootController(layout, animationType, passProps);
131
+    },
132
+    getInitialProps: async function() {
133
+      return await RCCManager.getInitialProps();
131 134
     }
132 135
   },
133 136
 

+ 6
- 1
src/deprecated/platformSpecificDeprecated.ios.js View File

@@ -586,6 +586,10 @@ function dismissLightBox(params) {
586 586
   Modal.dismissLightBox();
587 587
 }
588 588
 
589
+async function getInitialProps() {
590
+  return await ControllerRegistry.getInitialProps();
591
+}
592
+
589 593
 function showInAppNotification(params) {
590 594
   if (!params.screen) {
591 595
     console.error('showInAppNotification(params): params.screen is required');
@@ -721,5 +725,6 @@ export default {
721 725
   navigatorToggleNavBar,
722 726
   showContextualMenu,
723 727
   dismissContextualMenu,
724
-  getCurrentlyVisibleScreenId
728
+  getCurrentlyVisibleScreenId,
729
+  getInitialProps
725 730
 };