Преглед на файлове

Closes #3787 (#3934)

* Closes #3787

* Merge options only when viewController conforms to RNNRootViewProtocol

* better practice

* Fixes e2e
Yogev Ben David преди 6 години
родител
ревизия
ba626e919e
No account linked to committer's email address
променени са 3 файла, в които са добавени 4 реда и са изтрити 32 реда
  1. 4
    19
      lib/ios/RNNCommandsHandler.m
  2. 0
    1
      lib/ios/RNNTabBarController.h
  3. 0
    12
      lib/ios/RNNTabBarController.m

+ 4
- 19
lib/ios/RNNCommandsHandler.m Целия файл

@@ -67,29 +67,14 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
67 67
 - (void)mergeOptions:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion {
68 68
 	[self assertReady];
69 69
 	
70
-	UIViewController* vc = [_store findComponentForId:componentId];
71
-	if([vc isKindOfClass:[RNNRootViewController class]]) {
72
-		RNNRootViewController* rootVc = (RNNRootViewController*)vc;
73
-		[rootVc.options mergeWith:options];
70
+	UIViewController<RNNRootViewProtocol>* vc = (UIViewController<RNNRootViewProtocol>*)[_store findComponentForId:componentId];
71
+	if ([vc conformsToProtocol:@protocol(RNNRootViewProtocol)] || [vc isKindOfClass:[RNNRootViewController class]]) {
72
+		[vc.getLeafViewController.options mergeWith:options];
74 73
 		[CATransaction begin];
75 74
 		[CATransaction setCompletionBlock:completion];
76
-		
77
-		[rootVc.options applyOn:vc];
78
-		
79
-		[CATransaction commit];
80
-	}
81
-	
82
-	if ([vc isKindOfClass:[RNNSplitViewController class]]) {
83
-		RNNSplitViewController* splitVc = (RNNSplitViewController*)vc;
84
-		[splitVc.options mergeWith:options];
85
-		[CATransaction begin];
86
-		[CATransaction setCompletionBlock:completion];
87
-		
88
-		[splitVc.options applyOn:vc];
89
-		
75
+		[vc.getLeafViewController.options applyOn:vc.getLeafViewController];
90 76
 		[CATransaction commit];
91 77
 	}
92
-	
93 78
 }
94 79
 
95 80
 - (void)setDefaultOptions:(NSDictionary*)optionsDict completion:(RNNTransitionCompletionBlock)completion {

+ 0
- 1
lib/ios/RNNTabBarController.h Целия файл

@@ -7,7 +7,6 @@
7 7
 
8 8
 - (instancetype)initWithEventEmitter:(RNNEventEmitter*)eventEmitter;
9 9
 
10
-- (void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated;
11 10
 - (void)setSelectedIndexByComponentID:(NSString *)componentID;
12 11
 
13 12
 @end

+ 0
- 12
lib/ios/RNNTabBarController.m Целия файл

@@ -19,18 +19,6 @@
19 19
 	return self.selectedViewController.supportedInterfaceOrientations;
20 20
 }
21 21
 
22
-- (void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated {
23
-	CGRect frame = self.tabBar.frame;
24
-	CGFloat height = frame.size.height;
25
-	CGFloat offsetY = (hidden ? self.view.frame.size.height : self.view.frame.size.height-height);
26
-	frame.origin.y = offsetY;
27
-	NSTimeInterval duration = animated ? kTabBarHiddenDuration : 0.0;
28
-	
29
-	[UIView animateWithDuration:duration animations:^{
30
-		self.tabBar.frame = frame;
31
-	}];
32
-}
33
-
34 22
 - (void)setSelectedIndexByComponentID:(NSString *)componentID {
35 23
 	for (id child in self.childViewControllers) {
36 24
 		RNNRootViewController* vc = child;