Kaynağa Gözat

Fix setStackRoot options (#5217)

Yogev Ben David 5 yıl önce
ebeveyn
işleme
8ced96443f
No account linked to committer's email address
1 değiştirilmiş dosya ile 19 ekleme ve 19 silme
  1. 19
    19
      lib/ios/RNNCommandsHandler.m

+ 19
- 19
lib/ios/RNNCommandsHandler.m Dosyayı Görüntüle

@@ -55,23 +55,23 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
55 55
 
56 56
 - (void)setRoot:(NSDictionary*)layout commandId:(NSString*)commandId completion:(RNNTransitionCompletionBlock)completion {
57 57
 	[self assertReady];
58
-
58
+	
59 59
 	if (@available(iOS 9, *)) {
60
-	    if(_controllerFactory.defaultOptions.layout.direction.hasValue) {
61
-	        if ([_controllerFactory.defaultOptions.layout.direction.get isEqualToString:@"rtl"]) {
62
-                [[RCTI18nUtil sharedInstance] allowRTL:YES];
63
-                [[RCTI18nUtil sharedInstance] forceRTL:YES];
64
-                [[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
65
-                [[UINavigationBar appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
66
-            } else {
67
-                [[RCTI18nUtil sharedInstance] allowRTL:NO];
68
-                [[RCTI18nUtil sharedInstance] forceRTL:NO];
69
-                [[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
70
-                [[UINavigationBar appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
71
-            }
72
-	    }
60
+		if(_controllerFactory.defaultOptions.layout.direction.hasValue) {
61
+			if ([_controllerFactory.defaultOptions.layout.direction.get isEqualToString:@"rtl"]) {
62
+				[[RCTI18nUtil sharedInstance] allowRTL:YES];
63
+				[[RCTI18nUtil sharedInstance] forceRTL:YES];
64
+				[[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
65
+				[[UINavigationBar appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
66
+			} else {
67
+				[[RCTI18nUtil sharedInstance] allowRTL:NO];
68
+				[[RCTI18nUtil sharedInstance] forceRTL:NO];
69
+				[[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
70
+				[[UINavigationBar appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
71
+			}
72
+		}
73 73
 	}
74
-
74
+	
75 75
 	[_modalManager dismissAllModalsAnimated:NO];
76 76
 	
77 77
 	UIViewController *vc = [_controllerFactory createLayout:layout[@"root"]];
@@ -171,11 +171,11 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
171 171
 - (void)setStackRoot:(NSString*)componentId commandId:(NSString*)commandId children:(NSArray*)children completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
172 172
 	[self assertReady];
173 173
 	
174
- 	NSArray *childViewControllers = [_controllerFactory createChildrenLayout:children];
174
+	NSArray<UIViewController *> *childViewControllers = [_controllerFactory createChildrenLayout:children];
175 175
 	for (UIViewController<RNNLayoutProtocol>* viewController in childViewControllers) {
176 176
 		[viewController renderTreeAndWait:NO perform:nil];
177 177
 	}
178
-	RNNNavigationOptions* options = [childViewControllers.lastObject getCurrentChild].resolveOptions;
178
+	RNNNavigationOptions* options = childViewControllers.lastObject.resolveOptions;
179 179
 	UIViewController *fromVC = [RNNLayoutManager findComponentForId:componentId];
180 180
 	__weak typeof(RNNEventEmitter*) weakEventEmitter = _eventEmitter;
181 181
 	[_stackManager setStackChildren:childViewControllers fromViewController:fromVC animated:[options.animations.setStackRoot.enable getWithDefaultValue:YES] completion:^{
@@ -236,7 +236,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
236 236
 	}];
237 237
 	
238 238
 	[_stackManager popToRoot:vc animated:[vc.resolveOptions.animations.pop.enable getWithDefaultValue:YES] completion:^(NSArray *poppedViewControllers) {
239
-
239
+		
240 240
 	} rejection:^(NSString *code, NSString *message, NSError *error) {
241 241
 		
242 242
 	}];
@@ -269,7 +269,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
269 269
 	
270 270
 	RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
271 271
 	[modalToDismiss.getCurrentChild overrideOptions:options];
272
-		
272
+	
273 273
 	[CATransaction begin];
274 274
 	[CATransaction setCompletionBlock:^{
275 275
 		[_eventEmitter sendOnNavigationCommandCompletion:dismissModal commandId:commandId params:@{@"componentId": componentId}];