Browse Source

fixed apply options

yogevbd 6 years ago
parent
commit
61695e0e08
1 changed files with 7 additions and 9 deletions
  1. 7
    9
      lib/ios/RNNCommandsHandler.m

+ 7
- 9
lib/ios/RNNCommandsHandler.m View File

47
 	
47
 	
48
 	[_modalManager dismissAllModals];
48
 	[_modalManager dismissAllModals];
49
 	[_eventEmitter sendOnNavigationCommand:setRoot params:@{@"layout": layout}];
49
 	[_eventEmitter sendOnNavigationCommand:setRoot params:@{@"layout": layout}];
50
-
50
+	
51
 	UIViewController *vc = [_controllerFactory createLayoutAndSaveToStore:layout];
51
 	UIViewController *vc = [_controllerFactory createLayoutAndSaveToStore:layout];
52
 	
52
 	
53
 	UIApplication.sharedApplication.delegate.window.rootViewController = vc;
53
 	UIApplication.sharedApplication.delegate.window.rootViewController = vc;
58
 -(void) mergeOptions:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion {
58
 -(void) mergeOptions:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion {
59
 	[self assertReady];
59
 	[self assertReady];
60
 	[_eventEmitter sendOnNavigationCommand:mergeOptions params:@{@"componentId": componentId, @"options": options}];
60
 	[_eventEmitter sendOnNavigationCommand:mergeOptions params:@{@"componentId": componentId, @"options": options}];
61
-
61
+	
62
 	UIViewController* vc = [_store findComponentForId:componentId];
62
 	UIViewController* vc = [_store findComponentForId:componentId];
63
 	if([vc isKindOfClass:[RNNRootViewController class]]) {
63
 	if([vc isKindOfClass:[RNNRootViewController class]]) {
64
 		RNNRootViewController* rootVc = (RNNRootViewController*)vc;
64
 		RNNRootViewController* rootVc = (RNNRootViewController*)vc;
66
 		[CATransaction begin];
66
 		[CATransaction begin];
67
 		[CATransaction setCompletionBlock:completion];
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
 		[CATransaction commit];
71
 		[CATransaction commit];
74
 	}
72
 	}
92
 -(void)setStackRoot:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
90
 -(void)setStackRoot:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
93
 	[self assertReady];
91
 	[self assertReady];
94
 	[_eventEmitter sendOnNavigationCommand:setStackRoot params:@{@"componentId": componentId}];
92
 	[_eventEmitter sendOnNavigationCommand:setStackRoot params:@{@"componentId": componentId}];
95
-
93
+	
96
 	UIViewController<RNNRootViewProtocol> *newVc = [_controllerFactory createLayoutAndSaveToStore:layout];
94
 	UIViewController<RNNRootViewProtocol> *newVc = [_controllerFactory createLayoutAndSaveToStore:layout];
97
 	[_navigationStackManager setStackRoot:newVc fromComponent:componentId completion:^{
95
 	[_navigationStackManager setStackRoot:newVc fromComponent:componentId completion:^{
98
 		completion();
96
 		completion();
191
 - (void)dismissOverlay:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
189
 - (void)dismissOverlay:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
192
 	[self assertReady];
190
 	[self assertReady];
193
 	[_eventEmitter sendOnNavigationCommand:dismissModal params:@{@"componentId": componentId}];
191
 	[_eventEmitter sendOnNavigationCommand:dismissModal params:@{@"componentId": componentId}];
194
-	[_overlayManager dismissOverlay:componentId completion:^{	
192
+	[_overlayManager dismissOverlay:componentId completion:^{
195
 		completion();
193
 		completion();
196
 	}];
194
 	}];
197
 }
195
 }
201
 -(void) assertReady {
199
 -(void) assertReady {
202
 	if (!_store.isReadyToReceiveCommands) {
200
 	if (!_store.isReadyToReceiveCommands) {
203
 		[[NSException exceptionWithName:@"BridgeNotLoadedError"
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
 		 raise];
204
 		 raise];
207
 	}
205
 	}
208
 }
206
 }