Kaynağa Gözat

Fixed options merging issues, removed optionsResolver (#4100)

Yogev Ben David 6 yıl önce
ebeveyn
işleme
c64dc49901
No account linked to committer's email address

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

@@ -67,14 +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* vc = [_store findComponentForId:componentId];
70
+	UIViewController<RNNLayoutProtocol>* vc = (UIViewController<RNNLayoutProtocol>*)[_store findComponentForId:componentId];
71 71
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
72
-	
73
-	while (vc != nil) {
74
-		if ([vc conformsToProtocol:@protocol(RNNLayoutProtocol)]) {
75
-			[(UIViewController<RNNLayoutProtocol>*)vc mergeOptions:options];
76
-		}
77
-		vc = vc.parentViewController;
72
+	if ([vc conformsToProtocol:@protocol(RNNLayoutProtocol)] || [vc isKindOfClass:[RNNRootViewController class]]) {
73
+		[CATransaction begin];
74
+		[CATransaction setCompletionBlock:completion];
75
+		
76
+		[vc.getLeafViewController mergeAndPresentOptions:options];
77
+		
78
+		[CATransaction commit];
78 79
 	}
79 80
 }
80 81
 

+ 6
- 12
lib/ios/RNNControllerFactory.m Dosyayı Görüntüle

@@ -131,11 +131,10 @@
131 131
 	RNNNavigationControllerPresenter* presenter = [[RNNNavigationControllerPresenter alloc] init];
132 132
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
133 133
 	RNNNavigationOptions* options = [_optionsManager createOptions:node.data[@"options"]];
134
-	RNNParentOptionsResolver* optionsResolver = [[RNNParentOptionsResolver alloc] init];
135 134
 	
136 135
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
137 136
 	
138
-	RNNNavigationController* stack = [[RNNNavigationController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options optionsResolver:optionsResolver presenter:presenter];
137
+	RNNNavigationController* stack = [[RNNNavigationController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
139 138
 	
140 139
 	return stack;
141 140
 }
@@ -144,11 +143,10 @@
144 143
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
145 144
 	RNNNavigationOptions* options = [_optionsManager createOptions:node.data[@"options"]];
146 145
 	RNNTabBarPresenter* presenter = [[RNNTabBarPresenter alloc] init];
147
-	RNNParentOptionsResolver* optionsResolver = [[RNNParentOptionsResolver alloc] init];
148 146
 
149 147
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
150 148
 	
151
-	RNNTabBarController* tabsController = [[RNNTabBarController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options optionsResolver:optionsResolver presenter:presenter eventEmitter:_eventEmitter];
149
+	RNNTabBarController* tabsController = [[RNNTabBarController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter eventEmitter:_eventEmitter];
152 150
 	
153 151
 	return tabsController;
154 152
 }
@@ -157,11 +155,10 @@
157 155
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
158 156
 	RNNNavigationOptions* options = [_optionsManager createOptions:node.data[@"options"]];
159 157
 	RNNBasePresenter* presenter = [[RNNBasePresenter alloc] init];
160
-	RNNParentOptionsResolver* optionsResolver = [[RNNParentOptionsResolver alloc] init];
161 158
 
162 159
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
163 160
 	
164
-	RNNTopTabsViewController* topTabsController = [[RNNTopTabsViewController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options optionsResolver:optionsResolver presenter:presenter];
161
+	RNNTopTabsViewController* topTabsController = [[RNNTopTabsViewController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
165 162
 	
166 163
 	return topTabsController;
167 164
 }
@@ -170,11 +167,10 @@
170 167
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
171 168
 	RNNNavigationOptions* options = [_optionsManager createOptions:node.data[@"options"]];
172 169
 	RNNBasePresenter* presenter = [[RNNBasePresenter alloc] init];
173
-	RNNParentOptionsResolver* optionsResolver = [[RNNParentOptionsResolver alloc] init];
174 170
 
175 171
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
176 172
 	
177
-	RNNSideMenuController *sideMenu = [[RNNSideMenuController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options optionsResolver:optionsResolver presenter:presenter];
173
+	RNNSideMenuController *sideMenu = [[RNNSideMenuController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
178 174
 	
179 175
 	return sideMenu;
180 176
 }
@@ -184,9 +180,8 @@
184 180
 	UIViewController<RNNParentProtocol>* childVc = [self fromTree:node.children[0]];
185 181
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
186 182
 	RNNNavigationOptions* options = [_optionsManager createOptions:node.data[@"options"]];
187
-	RNNParentOptionsResolver* optionsResolver = [[RNNParentOptionsResolver alloc] init];
188 183
 
189
-	RNNSideMenuChildVC *sideMenuChild = [[RNNSideMenuChildVC alloc] initWithLayoutInfo:layoutInfo childViewControllers:@[childVc] options:options optionsResolver:optionsResolver presenter:[[RNNBasePresenter alloc] init] type:type];
184
+	RNNSideMenuChildVC *sideMenuChild = [[RNNSideMenuChildVC alloc] initWithLayoutInfo:layoutInfo childViewControllers:@[childVc] options:options presenter:[[RNNBasePresenter alloc] init] type:type];
190 185
 	
191 186
 	return sideMenuChild;
192 187
 }
@@ -195,11 +190,10 @@
195 190
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
196 191
 	RNNNavigationOptions* options = [_optionsManager createOptions:node.data[@"options"]];
197 192
 	RNNBasePresenter* presenter = [[RNNBasePresenter alloc] init];
198
-	RNNParentOptionsResolver* optionsResolver = [[RNNParentOptionsResolver alloc] init];
199 193
 
200 194
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
201 195
 
202
-	RNNSplitViewController* splitViewController = [[RNNSplitViewController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options optionsResolver:optionsResolver presenter:presenter];
196
+	RNNSplitViewController* splitViewController = [[RNNSplitViewController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
203 197
 
204 198
 	return splitViewController;
205 199
 }

+ 2
- 1
lib/ios/RNNLayoutProtocol.h Dosyayı Görüntüle

@@ -1,5 +1,6 @@
1 1
 #import "RNNLayoutInfo.h"
2 2
 #import "RNNBasePresenter.h"
3
+#import "RNNLeafProtocol.h"
3 4
 
4 5
 @protocol RNNLayoutProtocol <NSObject, UINavigationControllerDelegate, UIViewControllerTransitioningDelegate, UISplitViewControllerDelegate>
5 6
 
@@ -9,6 +10,6 @@
9 10
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
10 11
 @property (nonatomic, strong) RNNNavigationOptions* options;
11 12
 
12
-- (void)mergeOptions:(RNNNavigationOptions *)options;
13
+- (UIViewController<RNNLeafProtocol, RNNLayoutProtocol> *)getLeafViewController;
13 14
 
14 15
 @end

+ 3
- 4
lib/ios/RNNLeafProtocol.h Dosyayı Görüntüle

@@ -1,13 +1,12 @@
1
-#import "RNNLayoutProtocol.h"
2 1
 
3 2
 typedef void (^RNNReactViewReadyCompletionBlock)(void);
4 3
 
5
-@protocol RNNLeafProtocol <RNNLayoutProtocol>
4
+@protocol RNNLeafProtocol <NSObject>
6 5
 
7 6
 - (void)waitForReactViewRender:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock;
8 7
 
9
-- (UIViewController<RNNLeafProtocol> *)getLeafViewController;
10
-
11 8
 - (void)bindViewController:(UIViewController *)viewController;
12 9
 
10
+- (void)mergeAndPresentOptions:(RNNNavigationOptions *)newOptions;
11
+
13 12
 @end

+ 0
- 2
lib/ios/RNNNavigationController.h Dosyayı Görüntüle

@@ -1,13 +1,11 @@
1 1
 #import <UIKit/UIKit.h>
2 2
 #import "RNNParentProtocol.h"
3 3
 #import "RNNNavigationControllerPresenter.h"
4
-#import "RNNParentOptionsResolver.h"
5 4
 
6 5
 @interface RNNNavigationController : UINavigationController <RNNParentProtocol>
7 6
 
8 7
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
9 8
 @property (nonatomic, retain) RNNNavigationControllerPresenter* presenter;
10 9
 @property (nonatomic, strong) RNNNavigationOptions* options;
11
-@property (nonatomic, strong) RNNParentOptionsResolver* optionsResolver;
12 10
 
13 11
 @end

+ 1
- 13
lib/ios/RNNNavigationController.m Dosyayı Görüntüle

@@ -5,12 +5,11 @@
5 5
 
6 6
 @implementation RNNNavigationController
7 7
 
8
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options optionsResolver:(RNNParentOptionsResolver *)optionsResolver presenter:(RNNNavigationControllerPresenter *)presenter {
8
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNNavigationControllerPresenter *)presenter {
9 9
 	self = [super init];
10 10
 
11 11
 	self.presenter = presenter;
12 12
 	self.options = options;
13
-	self.optionsResolver = optionsResolver;
14 13
 	self.layoutInfo = layoutInfo;
15 14
 	
16 15
 	[self setViewControllers:childViewControllers];
@@ -62,20 +61,9 @@
62 61
 	return self.topViewController;
63 62
 }
64 63
 
65
-- (void)viewDidLoad {
66
-	[super viewDidLoad];
67
-	[_presenter present:self.options onViewControllerDidLoad:self];
68
-}
69
-
70 64
 - (void)willMoveToParentViewController:(UIViewController *)parent {
71
-	[_optionsResolver resolve:self with:self.childViewControllers];
72 65
 	[_presenter present:self.options onViewControllerDidLoad:self];
73 66
 }
74 67
 
75
-- (void)mergeOptions:(RNNNavigationOptions *)options {
76
-	[self.options mergeOptions:options overrideOptions:YES];
77
-	[self.presenter present:self.options onViewControllerWillAppear:self];
78
-}
79
-
80 68
 
81 69
 @end

+ 18
- 14
lib/ios/RNNNavigationOptions.m Dosyayı Görüntüle

@@ -19,7 +19,11 @@
19 19
 	[self.overlay applyOn:viewController];
20 20
 	[self.statusBar applyOn:viewController];
21 21
 	[self.layout applyOn:viewController];
22
-	[self applyOtherOptions:self on:viewController];
22
+	
23
+	[self applyOtherOptionsOn:viewController];
24
+	
25
+	[self applyOnNavigationController:viewController.navigationController];
26
+	[self applyOnTabBarController:viewController.tabBarController];
23 27
 }
24 28
 
25 29
 - (void)applyOnNavigationController:(UINavigationController *)navigationController {
@@ -27,19 +31,19 @@
27 31
 	[self.statusBar applyOn:navigationController];
28 32
 	[self.layout applyOn:navigationController];
29 33
 	[self.bottomTab applyOn:navigationController];
30
-	[self applyOtherOptions:self onNavigationController:navigationController];
34
+	[self applyOtherOptionsOnNavigationController:navigationController];
31 35
 }
32 36
 
33 37
 - (void)applyOnTabBarController:(UITabBarController *)tabBarController {
34 38
 	[self.bottomTabs applyOnTabBarController:tabBarController];
35 39
 }
36 40
 
37
-- (void)applyOtherOptions:(RNNNavigationOptions *)options onNavigationController:(UINavigationController*)navigationController {
38
-	if (options.popGesture) {
39
-		navigationController.interactivePopGestureRecognizer.enabled = [options.popGesture boolValue];
41
+- (void)applyOtherOptionsOnNavigationController:(UINavigationController*)navigationController {
42
+	if (self.popGesture) {
43
+		navigationController.interactivePopGestureRecognizer.enabled = [self.popGesture boolValue];
40 44
 	}
41 45
 	
42
-	if (options.rootBackgroundImage) {
46
+	if (self.rootBackgroundImage) {
43 47
 		UIImageView* backgroundImageView = (navigationController.view.subviews.count > 0) ? navigationController.view.subviews[0] : nil;
44 48
 		if (![backgroundImageView isKindOfClass:[UIImageView class]]) {
45 49
 			backgroundImageView = [[UIImageView alloc] initWithFrame:navigationController.view.bounds];
@@ -47,13 +51,13 @@
47 51
 		}
48 52
 		
49 53
 		backgroundImageView.layer.masksToBounds = YES;
50
-		backgroundImageView.image = [options.rootBackgroundImage isKindOfClass:[UIImage class]] ? (UIImage*)options.rootBackgroundImage : [RCTConvert UIImage:options.rootBackgroundImage];
54
+		backgroundImageView.image = [self.rootBackgroundImage isKindOfClass:[UIImage class]] ? (UIImage*)self.rootBackgroundImage : [RCTConvert UIImage:self.rootBackgroundImage];
51 55
 		[backgroundImageView setContentMode:UIViewContentModeScaleAspectFill];
52 56
 	}
53 57
 }
54 58
 
55
-- (void)applyOtherOptions:(RNNNavigationOptions *)options on:(UIViewController*)viewController {
56
-	if (options.backgroundImage) {
59
+- (void)applyOtherOptionsOn:(UIViewController*)viewController {
60
+	if (self.backgroundImage) {
57 61
 		UIImageView* backgroundImageView = (viewController.view.subviews.count > 0) ? viewController.view.subviews[0] : nil;
58 62
 		if (![backgroundImageView isKindOfClass:[UIImageView class]]) {
59 63
 			backgroundImageView = [[UIImageView alloc] initWithFrame:viewController.view.bounds];
@@ -61,16 +65,16 @@
61 65
 		}
62 66
 		
63 67
 		backgroundImageView.layer.masksToBounds = YES;
64
-		backgroundImageView.image = [options.backgroundImage isKindOfClass:[UIImage class]] ? (UIImage*)options.backgroundImage : [RCTConvert UIImage:options.backgroundImage];
68
+		backgroundImageView.image = [self.backgroundImage isKindOfClass:[UIImage class]] ? (UIImage*)self.backgroundImage : [RCTConvert UIImage:self.backgroundImage];
65 69
 		[backgroundImageView setContentMode:UIViewContentModeScaleAspectFill];
66 70
 	}
67 71
 
68
-	if (options.modalPresentationStyle) {
69
-		viewController.modalPresentationStyle = [RCTConvert UIModalPresentationStyle:options.modalPresentationStyle];
72
+	if (self.modalPresentationStyle) {
73
+		viewController.modalPresentationStyle = [RCTConvert UIModalPresentationStyle:self.modalPresentationStyle];
70 74
 		[viewController.view setBackgroundColor:[UIColor clearColor]];
71 75
 	}
72
-	if (options.modalTransitionStyle) {
73
-		viewController.modalTransitionStyle = [RCTConvert UIModalTransitionStyle:options.modalTransitionStyle];
76
+	if (self.modalTransitionStyle) {
77
+		viewController.modalTransitionStyle = [RCTConvert UIModalTransitionStyle:self.modalTransitionStyle];
74 78
 	}
75 79
 }
76 80
 

+ 0
- 8
lib/ios/RNNParentOptionsResolver.h Dosyayı Görüntüle

@@ -1,8 +0,0 @@
1
-#import <Foundation/Foundation.h>
2
-#import "RNNLayoutProtocol.h"
3
-
4
-@interface RNNParentOptionsResolver : NSObject
5
-
6
-- (void)resolve:(UIViewController<RNNLayoutProtocol> *)parent with:(NSArray<UIViewController<RNNLayoutProtocol> *> *)children;
7
-
8
-@end

+ 0
- 13
lib/ios/RNNParentOptionsResolver.m Dosyayı Görüntüle

@@ -1,13 +0,0 @@
1
-#import "RNNParentOptionsResolver.h"
2
-
3
-@implementation RNNParentOptionsResolver
4
-
5
-- (void)resolve:(UIViewController<RNNLayoutProtocol> *)parent with:(NSArray<UIViewController<RNNLayoutProtocol> *> *)children {
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
-	}
11
-}
12
-
13
-@end

+ 1
- 6
lib/ios/RNNParentProtocol.h Dosyayı Görüntüle

@@ -1,15 +1,10 @@
1 1
 #import "RNNLayoutProtocol.h"
2 2
 #import "RNNLeafProtocol.h"
3
-#import "RNNParentOptionsResolver.h"
4 3
 
5 4
 @protocol RNNParentProtocol <RNNLayoutProtocol, UINavigationControllerDelegate, UIViewControllerTransitioningDelegate, UISplitViewControllerDelegate>
6 5
 
7 6
 @required
8 7
 
9
-@property (nonatomic, strong) RNNParentOptionsResolver* optionsResolver;
10
-
11
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options optionsResolver:(RNNParentOptionsResolver *)optionsResolver presenter:(RNNBasePresenter *)presenter;
12
-
13
-- (UIViewController<RNNLeafProtocol> *)getLeafViewController;
8
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNBasePresenter *)presenter;
14 9
 
15 10
 @end

+ 2
- 1
lib/ios/RNNRootViewController.h Dosyayı Görüntüle

@@ -8,11 +8,12 @@
8 8
 #import "RNNUIBarButtonItem.h"
9 9
 #import "RNNLayoutInfo.h"
10 10
 #import "RNNLeafProtocol.h"
11
+#import "RNNLayoutProtocol.h"
11 12
 #import "RNNViewControllerPresenter.h"
12 13
 
13 14
 typedef void (^PreviewCallback)(UIViewController *vc);
14 15
 
15
-@interface RNNRootViewController : UIViewController	<RNNLeafProtocol, UIViewControllerPreviewingDelegate, UISearchResultsUpdating, UISearchBarDelegate, UINavigationControllerDelegate, UISplitViewControllerDelegate>
16
+@interface RNNRootViewController : UIViewController	<RNNLeafProtocol, RNNLayoutProtocol, UIViewControllerPreviewingDelegate, UISearchResultsUpdating, UISearchBarDelegate, UINavigationControllerDelegate, UISplitViewControllerDelegate>
16 17
 
17 18
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
18 19
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;

+ 4
- 3
lib/ios/RNNRootViewController.m Dosyayı Görüntüle

@@ -85,9 +85,10 @@
85 85
 	[_presenter present:self.options onViewControllerDidLoad:self];
86 86
 }
87 87
 
88
-- (void)mergeOptions:(RNNNavigationOptions *)options {
89
-	[self.options mergeOptions:options overrideOptions:YES];
90
-	[self.presenter present:self.options onViewControllerWillAppear:self];
88
+- (void)mergeAndPresentOptions:(RNNNavigationOptions *)newOptions {
89
+	[self.options mergeOptions:newOptions overrideOptions:YES];
90
+	[_presenter present:self.options onViewControllerWillAppear:self];
91
+	
91 92
 	[self initReactCustomViews];
92 93
 }
93 94
 

+ 1
- 2
lib/ios/RNNSideMenuChildVC.h Dosyayı Görüntüle

@@ -16,8 +16,7 @@ typedef NS_ENUM(NSInteger, RNNSideMenuChildType) {
16 16
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
17 17
 @property (nonatomic, retain) RNNBasePresenter* presenter;
18 18
 @property (nonatomic, strong) RNNNavigationOptions* options;
19
-@property (nonatomic, strong) RNNParentOptionsResolver* optionsResolver;
20 19
 
21
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options optionsResolver:(RNNParentOptionsResolver *)optionsResolver presenter:(RNNBasePresenter *)presenter type:(RNNSideMenuChildType)type;
20
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNBasePresenter *)presenter type:(RNNSideMenuChildType)type;
22 21
 
23 22
 @end

+ 3
- 10
lib/ios/RNNSideMenuChildVC.m Dosyayı Görüntüle

@@ -9,21 +9,20 @@
9 9
 
10 10
 @implementation RNNSideMenuChildVC
11 11
 
12
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options optionsResolver:(RNNParentOptionsResolver *)optionsResolver presenter:(RNNBasePresenter *)presenter type:(RNNSideMenuChildType)type {
13
-	self = [self initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options optionsResolver:optionsResolver presenter:presenter];
12
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNBasePresenter *)presenter type:(RNNSideMenuChildType)type {
13
+	self = [self initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
14 14
 	
15 15
 	self.type = type;
16 16
 
17 17
 	return self;
18 18
 }
19 19
 
20
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options optionsResolver:(RNNParentOptionsResolver *)optionsResolver presenter:(RNNBasePresenter *)presenter {
20
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNBasePresenter *)presenter {
21 21
 	self = [super init];
22 22
 	
23 23
 	self.presenter = presenter;
24 24
 	self.options = options;
25 25
 	self.layoutInfo = layoutInfo;
26
-	self.optionsResolver = optionsResolver;
27 26
 	
28 27
 	[self bindChildViewControllers:childViewControllers];
29 28
 	
@@ -45,15 +44,9 @@
45 44
 }
46 45
 
47 46
 - (void)willMoveToParentViewController:(UIViewController *)parent {
48
-	[_optionsResolver resolve:self with:self.childViewControllers];
49 47
 	[_presenter present:self.options onViewControllerDidLoad:self];
50 48
 }
51 49
 
52
-- (void)mergeOptions:(RNNNavigationOptions *)options {
53
-	[self.options mergeOptions:options overrideOptions:YES];
54
-	[self.presenter present:self.options onViewControllerWillAppear:self];
55
-}
56
-
57 50
 - (UIStatusBarStyle)preferredStatusBarStyle {
58 51
 	return self.child.preferredStatusBarStyle;
59 52
 }

+ 0
- 1
lib/ios/RNNSideMenuController.h Dosyayı Görüntüle

@@ -21,7 +21,6 @@
21 21
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
22 22
 @property (nonatomic, retain) RNNBasePresenter* presenter;
23 23
 @property (nonatomic, strong) RNNNavigationOptions* options;
24
-@property (nonatomic, strong) RNNParentOptionsResolver* optionsResolver;
25 24
 
26 25
 -(void)showSideMenu:(MMDrawerSide)side animated:(BOOL)animated;
27 26
 -(void)hideSideMenu:(MMDrawerSide)side animated:(BOOL)animated;

+ 1
- 8
lib/ios/RNNSideMenuController.m Dosyayı Görüntüle

@@ -21,13 +21,12 @@
21 21
 
22 22
 @implementation RNNSideMenuController
23 23
 
24
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options optionsResolver:(RNNParentOptionsResolver *)optionsResolver presenter:(RNNBasePresenter *)presenter {
24
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNBasePresenter *)presenter {
25 25
 	self = [super init];
26 26
 	
27 27
 	self.presenter = presenter;
28 28
 	self.options = options;
29 29
 	self.layoutInfo = layoutInfo;
30
-	self.optionsResolver = optionsResolver;
31 30
 	
32 31
 	[self bindChildViewControllers:childViewControllers];
33 32
 	
@@ -106,13 +105,7 @@
106 105
 }
107 106
 
108 107
 - (void)willMoveToParentViewController:(UIViewController *)parent {
109
-	[_optionsResolver resolve:self with:self.childViewControllers];
110 108
 	[_presenter present:self.options onViewControllerDidLoad:self];
111 109
 }
112 110
 
113
-- (void)mergeOptions:(RNNNavigationOptions *)options {
114
-	[self.options mergeOptions:options overrideOptions:YES];
115
-	[self.presenter present:self.options onViewControllerWillAppear:self];
116
-}
117
-
118 111
 @end

+ 0
- 1
lib/ios/RNNSplitViewController.h Dosyayı Görüntüle

@@ -15,6 +15,5 @@
15 15
 @property (nonatomic, strong) RNNNavigationOptions* options;
16 16
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
17 17
 @property (nonatomic, retain) RNNBasePresenter* presenter;
18
-@property (nonatomic, strong) RNNParentOptionsResolver* optionsResolver;
19 18
 
20 19
 @end

+ 1
- 7
lib/ios/RNNSplitViewController.m Dosyayı Görüntüle

@@ -2,13 +2,12 @@
2 2
 
3 3
 @implementation RNNSplitViewController
4 4
 
5
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options optionsResolver:(RNNParentOptionsResolver *)optionsResolver presenter:(RNNBasePresenter *)presenter {
5
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNBasePresenter *)presenter {
6 6
 	self = [super init];
7 7
 	
8 8
 	self.presenter = presenter;
9 9
 	self.options = options;
10 10
 	self.layoutInfo = layoutInfo;
11
-	self.optionsResolver = optionsResolver;
12 11
 	
13 12
 	self.navigationController.delegate = self;
14 13
 	
@@ -33,13 +32,8 @@
33 32
 }
34 33
 
35 34
 - (void)willMoveToParentViewController:(UIViewController *)parent {
36
-	[_optionsResolver resolve:self with:self.viewControllers];
37 35
 	[_presenter present:self.options onViewControllerDidLoad:self];
38 36
 }
39 37
 
40
-- (void)mergeOptions:(RNNNavigationOptions *)options {
41
-	[self.options mergeOptions:options overrideOptions:YES];
42
-	[self.presenter present:self.options onViewControllerWillAppear:self];
43
-}
44 38
 
45 39
 @end

+ 1
- 2
lib/ios/RNNTabBarController.h Dosyayı Görüntüle

@@ -5,13 +5,12 @@
5 5
 
6 6
 @interface RNNTabBarController : UITabBarController <RNNParentProtocol, UITabBarControllerDelegate>
7 7
 
8
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options optionsResolver:(RNNParentOptionsResolver *)optionsResolver presenter:(RNNBasePresenter *)presenter eventEmitter:(RNNEventEmitter *)eventEmitter;
8
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNBasePresenter *)presenter eventEmitter:(RNNEventEmitter *)eventEmitter;
9 9
 
10 10
 - (void)setSelectedIndexByComponentID:(NSString *)componentID;
11 11
 
12 12
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
13 13
 @property (nonatomic, retain) RNNBasePresenter* presenter;
14 14
 @property (nonatomic, strong) RNNNavigationOptions* options;
15
-@property (nonatomic, strong) RNNParentOptionsResolver* optionsResolver;
16 15
 
17 16
 @end

+ 1
- 10
lib/ios/RNNTabBarController.m Dosyayı Görüntüle

@@ -11,10 +11,9 @@
11 11
 - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo
12 12
 			  childViewControllers:(NSArray *)childViewControllers
13 13
 						   options:(RNNNavigationOptions *)options
14
-				   optionsResolver:(RNNParentOptionsResolver *)optionsResolver
15 14
 						 presenter:(RNNBasePresenter *)presenter
16 15
 					  eventEmitter:(RNNEventEmitter *)eventEmitter {
17
-	self = [self initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options optionsResolver:optionsResolver presenter:presenter];
16
+	self = [self initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
18 17
 	
19 18
 	_eventEmitter = eventEmitter;
20 19
 	
@@ -24,14 +23,12 @@
24 23
 - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo
25 24
 			  childViewControllers:(NSArray *)childViewControllers
26 25
 						   options:(RNNNavigationOptions *)options
27
-				   optionsResolver:(RNNParentOptionsResolver *)optionsResolver
28 26
 						 presenter:(RNNBasePresenter *)presenter {
29 27
 	self = [super init];
30 28
 	
31 29
 	self.presenter = presenter;
32 30
 	self.options = options;
33 31
 	self.layoutInfo = layoutInfo;
34
-	self.optionsResolver = optionsResolver;
35 32
 	
36 33
 	[self setViewControllers:childViewControllers];
37 34
 	
@@ -73,15 +70,9 @@
73 70
 }
74 71
 
75 72
 - (void)willMoveToParentViewController:(UIViewController *)parent {
76
-	[_optionsResolver resolve:self with:self.viewControllers];
77 73
 	[_presenter present:self.options onViewControllerDidLoad:self];
78 74
 }
79 75
 
80
-- (void)mergeOptions:(RNNNavigationOptions *)options {
81
-	[self.options mergeOptions:options overrideOptions:YES];
82
-	[self.presenter present:self.options onViewControllerWillAppear:self];
83
-}
84
-
85 76
 #pragma mark UITabBarControllerDelegate
86 77
 
87 78
 - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {

+ 0
- 1
lib/ios/RNNTopTabsViewController.h Dosyayı Görüntüle

@@ -10,7 +10,6 @@
10 10
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
11 11
 @property (nonatomic, retain) RNNBasePresenter* presenter;
12 12
 @property (nonatomic, strong) RNNNavigationOptions* options;
13
-@property (nonatomic, strong) RNNParentOptionsResolver* optionsResolver;
14 13
 
15 14
 - (void)setViewControllers:(NSArray*)viewControllers;
16 15
 - (void)viewController:(UIViewController*)vc changedTitle:(NSString*)title;

+ 1
- 7
lib/ios/RNNTopTabsViewController.m Dosyayı Görüntüle

@@ -13,13 +13,12 @@
13 13
 
14 14
 @implementation RNNTopTabsViewController
15 15
 
16
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options optionsResolver:(RNNParentOptionsResolver *)optionsResolver presenter:(RNNBasePresenter *)presenter {
16
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNBasePresenter *)presenter {
17 17
 	self = [self init];
18 18
 	
19 19
 	self.presenter = presenter;
20 20
 	self.options = options;
21 21
 	self.layoutInfo = layoutInfo;
22
-	self.optionsResolver = optionsResolver;
23 22
 	
24 23
 	[self setViewControllers:childViewControllers];
25 24
 	
@@ -86,14 +85,9 @@
86 85
 }
87 86
 
88 87
 - (void)willMoveToParentViewController:(UIViewController *)parent {
89
-	[_optionsResolver resolve:self with:_viewControllers];
90 88
 	[_presenter present:self.options onViewControllerDidLoad:self];
91 89
 }
92 90
 
93
-- (void)mergeOptions:(RNNNavigationOptions *)options {
94
-	[self.options mergeOptions:options overrideOptions:YES];
95
-	[self.presenter present:self.options onViewControllerWillAppear:self];
96
-}
97 91
 
98 92
 #pragma mark RNNParentProtocol
99 93
 

+ 0
- 8
lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj Dosyayı Görüntüle

@@ -115,8 +115,6 @@
115 115
 		50644A2120E11A720026709C /* Constants.m in Sources */ = {isa = PBXBuildFile; fileRef = 50644A1F20E11A720026709C /* Constants.m */; };
116 116
 		506A2B1420973DFD00F43A95 /* RNNErrorHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 506A2B1220973DFD00F43A95 /* RNNErrorHandler.h */; };
117 117
 		506A2B1520973DFD00F43A95 /* RNNErrorHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 506A2B1320973DFD00F43A95 /* RNNErrorHandler.m */; };
118
-		506F62E22163912E00AD0D0A /* RNNParentOptionsResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 506F62E02163912E00AD0D0A /* RNNParentOptionsResolver.h */; };
119
-		506F62E32163912E00AD0D0A /* RNNParentOptionsResolver.m in Sources */ = {isa = PBXBuildFile; fileRef = 506F62E12163912E00AD0D0A /* RNNParentOptionsResolver.m */; };
120 118
 		50706E6D20CE7CA5003345C3 /* UIImage+tint.h in Headers */ = {isa = PBXBuildFile; fileRef = 50706E6B20CE7CA5003345C3 /* UIImage+tint.h */; };
121 119
 		50706E6E20CE7CA5003345C3 /* UIImage+tint.m in Sources */ = {isa = PBXBuildFile; fileRef = 50706E6C20CE7CA5003345C3 /* UIImage+tint.m */; };
122 120
 		50762D08205E96C200E3D18A /* RNNModalAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 50762D06205E96C200E3D18A /* RNNModalAnimation.h */; };
@@ -360,8 +358,6 @@
360 358
 		50644A1F20E11A720026709C /* Constants.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Constants.m; sourceTree = "<group>"; };
361 359
 		506A2B1220973DFD00F43A95 /* RNNErrorHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNErrorHandler.h; sourceTree = "<group>"; };
362 360
 		506A2B1320973DFD00F43A95 /* RNNErrorHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNErrorHandler.m; sourceTree = "<group>"; };
363
-		506F62E02163912E00AD0D0A /* RNNParentOptionsResolver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNParentOptionsResolver.h; sourceTree = "<group>"; };
364
-		506F62E12163912E00AD0D0A /* RNNParentOptionsResolver.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNParentOptionsResolver.m; sourceTree = "<group>"; };
365 361
 		50706E6B20CE7CA5003345C3 /* UIImage+tint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIImage+tint.h"; sourceTree = "<group>"; };
366 362
 		50706E6C20CE7CA5003345C3 /* UIImage+tint.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIImage+tint.m"; sourceTree = "<group>"; };
367 363
 		50762D06205E96C200E3D18A /* RNNModalAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNModalAnimation.h; sourceTree = "<group>"; };
@@ -706,8 +702,6 @@
706 702
 				50570BE82063E09B006A1B5C /* RNNTitleViewHelper.h */,
707 703
 				501CD31D214A5B6900A6E225 /* RNNLayoutInfo.h */,
708 704
 				501CD31E214A5B6900A6E225 /* RNNLayoutInfo.m */,
709
-				506F62E02163912E00AD0D0A /* RNNParentOptionsResolver.h */,
710
-				506F62E12163912E00AD0D0A /* RNNParentOptionsResolver.m */,
711 705
 				50220F46212ABDFD004C2B0A /* RNNReactRootView.h */,
712 706
 				50220F47212ABDFD004C2B0A /* RNNReactRootView.m */,
713 707
 				501E0215213E7EA3003365C5 /* RNNReactView.h */,
@@ -918,7 +912,6 @@
918 912
 				50415CBA20553B8E00BB682E /* RNNScreenTransition.h in Headers */,
919 913
 				263905C21E4C6F440023D7D3 /* SidebarAnimation.h in Headers */,
920 914
 				E8E518361F83B94A000467AC /* RNNViewLocation.h in Headers */,
921
-				506F62E22163912E00AD0D0A /* RNNParentOptionsResolver.h in Headers */,
922 915
 				505EDD34214E7B7B0071C7DE /* RNNLeafProtocol.h in Headers */,
923 916
 				263905B51E4C6F440023D7D3 /* MMExampleDrawerVisualStateManager.h in Headers */,
924 917
 				50451D052042DAEB00695F00 /* RNNPushAnimation.h in Headers */,
@@ -1188,7 +1181,6 @@
1188 1181
 				50F5DFC61F407AA0001A00BC /* RNNNavigationController.m in Sources */,
1189 1182
 				21B85E5D1F44480200B314B5 /* RNNNavigationButtons.m in Sources */,
1190 1183
 				E8E518371F83B94A000467AC /* RNNViewLocation.m in Sources */,
1191
-				506F62E32163912E00AD0D0A /* RNNParentOptionsResolver.m in Sources */,
1192 1184
 				E3458D3E20BD9CE40023149B /* RNNPreviewOptions.m in Sources */,
1193 1185
 				263905C91E4C6F440023D7D3 /* SidebarFlipboardAnimation.m in Sources */,
1194 1186
 			);

+ 3
- 3
lib/ios/ReactNativeNavigationTests/RNNNavigationControllerTest.m Dosyayı Görüntüle

@@ -43,7 +43,7 @@
43 43
 	NSNumber* popGestureEnabled = @(0);
44 44
 	self.uut.options.popGesture = popGestureEnabled;
45 45
 	
46
-	[self.uut viewDidLoad];
46
+	[self.uut willMoveToParentViewController:nil];
47 47
 
48 48
 	XCTAssertFalse(self.uut.interactivePopGestureRecognizer.enabled);
49 49
 }
@@ -60,13 +60,13 @@
60 60
 - (void)testRootBackgroundImage {
61 61
 	UIImage* rootBackgroundImage = [[UIImage alloc] init];
62 62
 	self.uut.options.rootBackgroundImage = rootBackgroundImage;
63
-	[self.uut viewDidLoad];
63
+	[self.uut willMoveToParentViewController:nil];
64 64
 	XCTAssertTrue([[(UIImageView*)self.uut.view.subviews[0] image] isEqual:rootBackgroundImage]);
65 65
 }
66 66
 
67 67
 - (void)testTopBarBackgroundClipToBounds_true {
68 68
 	self.uut.options.topBar.background.clipToBounds = @(1);
69
-	[self.uut viewDidLoad];
69
+	[self.uut willMoveToParentViewController:nil];
70 70
 
71 71
 	XCTAssertTrue(self.uut.navigationBar.clipsToBounds);
72 72
 }