Bläddra i källkod

Fixes options merging

yogevbd 6 år sedan
förälder
incheckning
5d98174699

+ 3
- 7
lib/ios/RNNCommandsHandler.m Visa fil

@@ -67,19 +67,15 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
67 67
 - (void)mergeOptions:(NSString*)componentId options:(NSDictionary*)mergeOptions completion:(RNNTransitionCompletionBlock)completion {
68 68
 	[self assertReady];
69 69
 	
70
-	UIViewController<RNNLayoutProtocol>* vc = (UIViewController<RNNLayoutProtocol>*)[_store findComponentForId:componentId];
70
+	UIViewController* vc = [_store findComponentForId:componentId];
71 71
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
72
-	[CATransaction begin];
73
-	[CATransaction setCompletionBlock:completion];
74 72
 	
75 73
 	while (vc != nil) {
76 74
 		if ([vc conformsToProtocol:@protocol(RNNLayoutProtocol)]) {
77
-			[vc mergeOptions:options];
75
+			[(UIViewController<RNNLayoutProtocol>*)vc mergeOptions:options];
78 76
 		}
79
-		vc = (UIViewController<RNNLayoutProtocol>*)vc.parentViewController;
77
+		vc = vc.parentViewController;
80 78
 	}
81
-
82
-	[CATransaction commit];
83 79
 }
84 80
 
85 81
 - (void)setDefaultOptions:(NSDictionary*)optionsDict completion:(RNNTransitionCompletionBlock)completion {

+ 3
- 0
lib/ios/RNNNavigationControllerPresenter.m Visa fil

@@ -4,7 +4,10 @@
4 4
 
5 5
 - (void)present:(RNNNavigationOptions *)options onViewControllerDidLoad:(UINavigationController *)navigationController {
6 6
 	[options applyOnNavigationController:navigationController];
7
+}
7 8
 
9
+- (void)present:(RNNNavigationOptions *)options onViewControllerWillAppear:(UINavigationController *)navigationController {
10
+	[options applyOnNavigationController:navigationController];
8 11
 }
9 12
 
10 13
 @end

+ 5
- 1
lib/ios/RNNParentOptionsResolver.m Visa fil

@@ -3,7 +3,11 @@
3 3
 @implementation RNNParentOptionsResolver
4 4
 
5 5
 - (void)resolve:(UIViewController<RNNLayoutProtocol> *)parent with:(NSArray<UIViewController<RNNLayoutProtocol> *> *)children {
6
-	
6
+	for (UIViewController<RNNLayoutProtocol>* child in parent.childViewControllers) {
7
+		if ([parent conformsToProtocol:@protocol(RNNLayoutProtocol)] && [child conformsToProtocol:@protocol(RNNLayoutProtocol)]) {
8
+			[parent.options mergeOptions:child.options overrideOptions:YES];
9
+		}
10
+	}
7 11
 }
8 12
 
9 13
 @end