Ver código fonte

fixed apply options

yogevbd 6 anos atrás
pai
commit
61695e0e08
1 arquivos alterados com 7 adições e 9 exclusões
  1. 7
    9
      lib/ios/RNNCommandsHandler.m

+ 7
- 9
lib/ios/RNNCommandsHandler.m Ver arquivo

@@ -47,7 +47,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
47 47
 	
48 48
 	[_modalManager dismissAllModals];
49 49
 	[_eventEmitter sendOnNavigationCommand:setRoot params:@{@"layout": layout}];
50
-
50
+	
51 51
 	UIViewController *vc = [_controllerFactory createLayoutAndSaveToStore:layout];
52 52
 	
53 53
 	UIApplication.sharedApplication.delegate.window.rootViewController = vc;
@@ -58,7 +58,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
58 58
 -(void) mergeOptions:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion {
59 59
 	[self assertReady];
60 60
 	[_eventEmitter sendOnNavigationCommand:mergeOptions params:@{@"componentId": componentId, @"options": options}];
61
-
61
+	
62 62
 	UIViewController* vc = [_store findComponentForId:componentId];
63 63
 	if([vc isKindOfClass:[RNNRootViewController class]]) {
64 64
 		RNNRootViewController* rootVc = (RNNRootViewController*)vc;
@@ -66,9 +66,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
66 66
 		[CATransaction begin];
67 67
 		[CATransaction setCompletionBlock:completion];
68 68
 		
69
-		if (rootVc.isViewLoaded && rootVc.view.window) {
70
-			[rootVc.options applyOn:vc];
71
-		}
69
+		[rootVc.options applyOn:vc];
72 70
 		
73 71
 		[CATransaction commit];
74 72
 	}
@@ -92,7 +90,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
92 90
 -(void)setStackRoot:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
93 91
 	[self assertReady];
94 92
 	[_eventEmitter sendOnNavigationCommand:setStackRoot params:@{@"componentId": componentId}];
95
-
93
+	
96 94
 	UIViewController<RNNRootViewProtocol> *newVc = [_controllerFactory createLayoutAndSaveToStore:layout];
97 95
 	[_navigationStackManager setStackRoot:newVc fromComponent:componentId completion:^{
98 96
 		completion();
@@ -191,7 +189,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
191 189
 - (void)dismissOverlay:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
192 190
 	[self assertReady];
193 191
 	[_eventEmitter sendOnNavigationCommand:dismissModal params:@{@"componentId": componentId}];
194
-	[_overlayManager dismissOverlay:componentId completion:^{	
192
+	[_overlayManager dismissOverlay:componentId completion:^{
195 193
 		completion();
196 194
 	}];
197 195
 }
@@ -201,8 +199,8 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
201 199
 -(void) assertReady {
202 200
 	if (!_store.isReadyToReceiveCommands) {
203 201
 		[[NSException exceptionWithName:@"BridgeNotLoadedError"
204
-								reason:@"Bridge not yet loaded! Send commands after Navigation.events().onAppLaunched() has been called."
205
-							  userInfo:nil]
202
+								 reason:@"Bridge not yet loaded! Send commands after Navigation.events().onAppLaunched() has been called."
203
+							   userInfo:nil]
206 204
 		 raise];
207 205
 	}
208 206
 }