Quellcode durchsuchen

Detached defaultOptions from presenters (#4219)

Yogev Ben David vor 6 Jahren
Ursprung
Commit
4f3cbf0ab3
Es ist kein Benutzerkonto mit dieser Commiter-Email verbunden
34 geänderte Dateien mit 389 neuen und 384 gelöschten Zeilen
  1. 2
    6
      lib/ios/RNNBasePresenter.h
  2. 21
    23
      lib/ios/RNNBasePresenter.m
  3. 0
    13
      lib/ios/RNNBottomTabPresenter.h
  4. 0
    45
      lib/ios/RNNBottomTabPresenter.m
  5. 24
    24
      lib/ios/RNNCommandsHandler.m
  6. 9
    15
      lib/ios/RNNControllerFactory.m
  7. 2
    2
      lib/ios/RNNDefaultOptionsHelper.m
  8. 5
    0
      lib/ios/RNNLayoutProtocol.h
  9. 2
    2
      lib/ios/RNNModalManager.m
  10. 1
    0
      lib/ios/RNNNavigationController.h
  11. 13
    7
      lib/ios/RNNNavigationController.m
  12. 34
    37
      lib/ios/RNNNavigationControllerPresenter.m
  13. 1
    1
      lib/ios/RNNParentProtocol.h
  14. 7
    3
      lib/ios/RNNRootViewController.h
  15. 39
    37
      lib/ios/RNNRootViewController.m
  16. 2
    1
      lib/ios/RNNSideMenuChildVC.h
  17. 10
    6
      lib/ios/RNNSideMenuChildVC.m
  18. 1
    0
      lib/ios/RNNSideMenuController.h
  19. 9
    4
      lib/ios/RNNSideMenuController.m
  20. 31
    33
      lib/ios/RNNSideMenuPresenter.m
  21. 1
    0
      lib/ios/RNNSplitViewController.h
  22. 8
    3
      lib/ios/RNNSplitViewController.m
  23. 2
    1
      lib/ios/RNNTabBarController.h
  24. 11
    4
      lib/ios/RNNTabBarController.m
  25. 21
    25
      lib/ios/RNNTabBarPresenter.m
  26. 1
    0
      lib/ios/RNNTopTabsViewController.h
  27. 8
    3
      lib/ios/RNNTopTabsViewController.m
  28. 36
    40
      lib/ios/RNNViewControllerPresenter.m
  29. 4
    12
      lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj
  30. 3
    3
      lib/ios/ReactNativeNavigationTests/RNNBasePresenterTest.m
  31. 3
    3
      lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m
  32. 38
    7
      lib/ios/ReactNativeNavigationTests/RNNNavigationControllerTest.m
  33. 31
    15
      lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m
  34. 9
    9
      lib/ios/ReactNativeNavigationTests/RNNTabBarControllerTest.m

+ 2
- 6
lib/ios/RNNBasePresenter.h Datei anzeigen

@@ -4,18 +4,14 @@
4 4
 
5 5
 @property (nonatomic, weak) id bindedViewController;
6 6
 
7
-@property (nonatomic, retain) RNNNavigationOptions* defaultOptions;
8
-
9 7
 - (void)bindViewController:(UIViewController *)bindedViewController;
10 8
 
11 9
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions;
12 10
 
13
-- (void)applyOptions:(RNNNavigationOptions *)initialOptions;
11
+- (void)applyOptions:(RNNNavigationOptions *)options;
14 12
 
15 13
 - (void)applyOptionsOnWillMoveToParentViewController:(RNNNavigationOptions *)options;
16 14
 
17
-- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions;
18
-
19
-- (void)setDefaultOptions:(RNNNavigationOptions *)defaultOptions;
15
+- (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions defaultOptions:(RNNNavigationOptions *)defaultOptions;
20 16
 
21 17
 @end

+ 21
- 23
lib/ios/RNNBasePresenter.m Datei anzeigen

@@ -1,23 +1,11 @@
1 1
 #import "RNNBasePresenter.h"
2
-#import "RNNBottomTabPresenter.h"
3
-
4
-@interface RNNBasePresenter()
5
-
6
-@property (nonatomic, strong) RNNBottomTabPresenter* bottomTabPresenter;
7
-
8
-@end
2
+#import "UIViewController+RNNOptions.h"
3
+#import "RNNTabBarItemCreator.h"
9 4
 
10 5
 @implementation RNNBasePresenter
11 6
 
12
-- (instancetype)init {
13
-	self = [super init];
14
-	self.bottomTabPresenter = [[RNNBottomTabPresenter alloc] init];
15
-	return self;
16
-}
17
-
18 7
 - (void)bindViewController:(UIViewController *)bindedViewController {
19 8
 	_bindedViewController = bindedViewController;
20
-	[self.bottomTabPresenter bindViewController:bindedViewController];
21 9
 }
22 10
 
23 11
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
@@ -25,20 +13,30 @@
25 13
 }
26 14
 
27 15
 - (void)applyOptionsOnWillMoveToParentViewController:(RNNNavigationOptions *)options {
28
-	[self.bottomTabPresenter applyOptions:options];
16
+	UIViewController* viewController = self.bindedViewController;
17
+	if ((options.bottomTab.text.hasValue || options.bottomTab.icon.hasValue || options.bottomTab.selectedIcon.hasValue)) {
18
+		UITabBarItem* tabItem = [RNNTabBarItemCreator updateTabBarItem:viewController.tabBarItem bottomTabOptions:options.bottomTab];
19
+		viewController.tabBarItem = tabItem;
20
+		[options.bottomTab.text consume];
21
+		[options.bottomTab.icon consume];
22
+		[options.bottomTab.selectedIcon consume];
23
+	}
29 24
 }
30 25
 
31
-- (void)applyOptions:(RNNNavigationOptions *)initialOptions {
32
-	[self.bottomTabPresenter applyOptions:initialOptions];
26
+- (void)applyOptions:(RNNNavigationOptions *)options {
27
+	UIViewController* viewController = self.bindedViewController;
28
+	
29
+	if ([viewController.parentViewController isKindOfClass:[UITabBarController class]]) {
30
+		[viewController rnn_setTabBarItemBadge:[options.bottomTab.badge getWithDefaultValue:nil]];
31
+	}
33 32
 }
34 33
 
35
-- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
36
-	[self.bottomTabPresenter mergeOptions:options resolvedOptions:resolvedOptions];
34
+- (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions defaultOptions:(RNNNavigationOptions *)defaultOptions {
35
+	UIViewController* viewController = self.bindedViewController;
36
+	if (newOptions.bottomTab.badge.hasValue && [viewController.parentViewController isKindOfClass:[UITabBarController class]]) {
37
+		[viewController rnn_setTabBarItemBadge:newOptions.bottomTab.badge.get];
38
+	}
37 39
 }
38 40
 
39
-- (void)setDefaultOptions:(RNNNavigationOptions *)defaultOptions {
40
-	_defaultOptions = defaultOptions;
41
-	[self.bottomTabPresenter setDefaultOptions:defaultOptions];
42
-}
43 41
 
44 42
 @end

+ 0
- 13
lib/ios/RNNBottomTabPresenter.h Datei anzeigen

@@ -1,13 +0,0 @@
1
-#import "RNNBasePresenter.h"
2
-
3
-@interface RNNBottomTabPresenter : NSObject
4
-
5
-- (void)bindViewController:(UIViewController *)viewController;
6
-
7
-- (void)applyOptions:(RNNNavigationOptions *)options;
8
-
9
-- (void)setDefaultOptions:(RNNNavigationOptions *)defaultOptions;
10
-
11
-- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions;
12
-
13
-@end

+ 0
- 45
lib/ios/RNNBottomTabPresenter.m Datei anzeigen

@@ -1,45 +0,0 @@
1
-#import "RNNBottomTabPresenter.h"
2
-#import "RNNTabBarItemCreator.h"
3
-#import "UIViewController+RNNOptions.h"
4
-
5
-@interface RNNBottomTabPresenter()
6
-
7
-@property (nonatomic, weak) id bindedViewController;
8
-@property (nonatomic, retain) RNNNavigationOptions* defaultOptions;
9
-
10
-@end
11
-
12
-@implementation RNNBottomTabPresenter
13
-
14
-- (void)bindViewController:(UIViewController *)viewController {
15
-	_bindedViewController = viewController;
16
-}
17
-
18
-- (void)applyOptions:(RNNNavigationOptions *)options {
19
-	UIViewController* viewController = self.bindedViewController;
20
-	if ((options.bottomTab.text.hasValue || options.bottomTab.icon.hasValue || options.bottomTab.selectedIcon.hasValue)) {
21
-		RNNNavigationOptions* withDefault = (RNNNavigationOptions *)[[options copy] withDefault:self.defaultOptions];
22
-		UITabBarItem* tabItem = [RNNTabBarItemCreator updateTabBarItem:viewController.tabBarItem bottomTabOptions:withDefault.bottomTab];
23
-		viewController.tabBarItem = tabItem;
24
-		[options.bottomTab.text consume];
25
-		[options.bottomTab.icon consume];
26
-		[options.bottomTab.selectedIcon consume];
27
-	}
28
-	
29
-	if ([viewController.parentViewController isKindOfClass:[UITabBarController class]]) {
30
-		[viewController rnn_setTabBarItemBadge:[options.bottomTab.badge getWithDefaultValue:nil]];
31
-	}
32
-}
33
-
34
-- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
35
-	UIViewController* viewController = self.bindedViewController;
36
-	if (options.bottomTab.badge.hasValue && [viewController.parentViewController isKindOfClass:[UITabBarController class]]) {
37
-		[viewController rnn_setTabBarItemBadge:options.bottomTab.badge.get];
38
-	}
39
-}
40
-
41
-- (void)setDefaultOptions:(RNNNavigationOptions *)defaultOptions {
42
-	_defaultOptions = defaultOptions;
43
-}
44
-
45
-@end

+ 24
- 24
lib/ios/RNNCommandsHandler.m Datei anzeigen

@@ -75,7 +75,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
75 75
 		[CATransaction begin];
76 76
 		[CATransaction setCompletionBlock:completion];
77 77
 		
78
-		[vc.options overrideOptions:newOptions];
78
+		[vc overrideOptions:newOptions];
79 79
 		[vc mergeOptions:newOptions];
80 80
 
81 81
 		[CATransaction commit];
@@ -99,7 +99,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
99 99
 	UIViewController<RNNLayoutProtocol> *newVc = [_controllerFactory createLayout:layout saveToStore:_store];
100 100
 	UIViewController *fromVC = [_store findComponentForId:componentId];
101 101
 	
102
-	if ([[newVc.options.preview.reactTag getWithDefaultValue:@(0)] floatValue] > 0) {
102
+	if ([[newVc.resolveOptions.preview.reactTag getWithDefaultValue:@(0)] floatValue] > 0) {
103 103
 		UIViewController* vc = [_store findComponentForId:componentId];
104 104
 		
105 105
 		if([vc isKindOfClass:[RNNRootViewController class]]) {
@@ -109,7 +109,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
109 109
       		rootVc.previewCallback = ^(UIViewController *vcc) {
110 110
 				RNNRootViewController* rvc  = (RNNRootViewController*)vcc;
111 111
 				[self->_eventEmitter sendOnPreviewCompleted:componentId previewComponentId:newVc.layoutInfo.componentId];
112
-				if ([newVc.options.preview.commit getWithDefaultValue:NO]) {
112
+				if ([newVc.resolveOptions.preview.commit getWithDefaultValue:NO]) {
113 113
 					[CATransaction begin];
114 114
 					[CATransaction setCompletionBlock:^{
115 115
 						[self->_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
@@ -122,27 +122,27 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
122 122
 			
123 123
 			CGSize size = CGSizeMake(rootVc.view.frame.size.width, rootVc.view.frame.size.height);
124 124
 			
125
-			if (newVc.options.preview.width.hasValue) {
126
-				size.width = [newVc.options.preview.width.get floatValue];
125
+			if (newVc.resolveOptions.preview.width.hasValue) {
126
+				size.width = [newVc.resolveOptions.preview.width.get floatValue];
127 127
 			}
128 128
 			
129
-			if (newVc.options.preview.height.hasValue) {
130
-				size.height = [newVc.options.preview.height.get floatValue];
129
+			if (newVc.resolveOptions.preview.height.hasValue) {
130
+				size.height = [newVc.resolveOptions.preview.height.get floatValue];
131 131
 			}
132 132
 			
133
-			if (newVc.options.preview.width.hasValue || newVc.options.preview.height.hasValue) {
133
+			if (newVc.resolveOptions.preview.width.hasValue || newVc.resolveOptions.preview.height.hasValue) {
134 134
 				newVc.preferredContentSize = size;
135 135
 			}
136 136
       
137 137
 			RCTExecuteOnMainQueue(^{
138
-				UIView *view = [[ReactNativeNavigation getBridge].uiManager viewForReactTag:newVc.options.preview.reactTag.get];
138
+				UIView *view = [[ReactNativeNavigation getBridge].uiManager viewForReactTag:newVc.resolveOptions.preview.reactTag.get];
139 139
 				[rootVc registerForPreviewingWithDelegate:(id)rootVc sourceView:view];
140 140
 			});
141 141
 		}
142 142
 	} else {
143
-		id animationDelegate = (newVc.options.animations.push.hasCustomAnimation || newVc.getCurrentChild.isCustomTransitioned) ? newVc : nil;
144
-		[newVc.getCurrentChild waitForReactViewRender:(newVc.options.animations.push.waitForRender || animationDelegate) perform:^{
145
-			[_stackManager push:newVc onTop:fromVC animated:newVc.options.animations.push.enable animationDelegate:animationDelegate completion:^{
143
+		id animationDelegate = (newVc.resolveOptions.animations.push.hasCustomAnimation || newVc.getCurrentChild.isCustomTransitioned) ? newVc : nil;
144
+		[newVc.getCurrentChild waitForReactViewRender:(newVc.resolveOptions.animations.push.waitForRender || animationDelegate) perform:^{
145
+			[_stackManager push:newVc onTop:fromVC animated:newVc.resolveOptions.animations.push.enable animationDelegate:animationDelegate completion:^{
146 146
 				[_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
147 147
 				completion();
148 148
 			} rejection:rejection];
@@ -154,7 +154,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
154 154
 	[self assertReady];
155 155
 	
156 156
 	UIViewController<RNNParentProtocol> *newVC = [_controllerFactory createLayout:layout saveToStore:_store];
157
-	RNNNavigationOptions* options = [newVC getCurrentChild].options;
157
+	RNNNavigationOptions* options = [newVC getCurrentChild].resolveOptions;
158 158
 	UIViewController *fromVC = [_store findComponentForId:componentId];
159 159
 	__weak typeof(RNNEventEmitter*) weakEventEmitter = _eventEmitter;
160 160
 	[_stackManager setStackRoot:newVC fromViewController:fromVC animated:options.animations.setStackRoot.enable completion:^{
@@ -168,12 +168,12 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
168 168
 	
169 169
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
170 170
 	RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
171
-	[vc.options overrideOptions:options];
171
+	[vc overrideOptions:options];
172 172
 	
173 173
 	UINavigationController *nvc = vc.navigationController;
174 174
 	
175 175
 	if ([nvc topViewController] == vc) {
176
-		if (vc.options.animations.pop) {
176
+		if (vc.resolveOptions.animations.pop) {
177 177
 			nvc.delegate = vc;
178 178
 		} else {
179 179
 			nvc.delegate = nil;
@@ -181,10 +181,10 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
181 181
 	} else {
182 182
 		NSMutableArray * vcs = nvc.viewControllers.mutableCopy;
183 183
 		[vcs removeObject:vc];
184
-		[nvc setViewControllers:vcs animated:vc.options.animations.pop.enable];
184
+		[nvc setViewControllers:vcs animated:vc.resolveOptions.animations.pop.enable];
185 185
 	}
186 186
 	
187
-	[_stackManager pop:vc animated:vc.options.animations.pop.enable completion:^{
187
+	[_stackManager pop:vc animated:vc.resolveOptions.animations.pop.enable completion:^{
188 188
 		[_store removeComponent:componentId];
189 189
 		[_eventEmitter sendOnNavigationCommandCompletion:pop params:@{@"componentId": componentId}];
190 190
 		completion();
@@ -195,9 +195,9 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
195 195
 	[self assertReady];
196 196
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
197 197
 	RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
198
-	[vc.options overrideOptions:options];
198
+	[vc overrideOptions:options];
199 199
 	
200
-	[_stackManager popTo:vc animated:vc.options.animations.pop.enable completion:^(NSArray *poppedViewControllers) {
200
+	[_stackManager popTo:vc animated:vc.resolveOptions.animations.pop.enable completion:^(NSArray *poppedViewControllers) {
201 201
 		[_eventEmitter sendOnNavigationCommandCompletion:popTo params:@{@"componentId": componentId}];
202 202
 		[self removePopedViewControllers:poppedViewControllers];
203 203
 		completion();
@@ -208,7 +208,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
208 208
 	[self assertReady];
209 209
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
210 210
 	RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
211
-	[vc.options overrideOptions:options];
211
+	[vc overrideOptions:options];
212 212
 	
213 213
 	[CATransaction begin];
214 214
 	[CATransaction setCompletionBlock:^{
@@ -216,7 +216,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
216 216
 		completion();
217 217
 	}];
218 218
 	
219
-	[_stackManager popToRoot:vc animated:vc.options.animations.pop.enable completion:^(NSArray *poppedViewControllers) {
219
+	[_stackManager popToRoot:vc animated:vc.resolveOptions.animations.pop.enable completion:^(NSArray *poppedViewControllers) {
220 220
 		[self removePopedViewControllers:poppedViewControllers];
221 221
 	} rejection:^(NSString *code, NSString *message, NSError *error) {
222 222
 		
@@ -230,8 +230,8 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
230 230
 	
231 231
 	UIViewController<RNNParentProtocol> *newVc = [_controllerFactory createLayout:layout saveToStore:_store];
232 232
 	
233
-	[newVc.getCurrentChild waitForReactViewRender:newVc.getCurrentChild.options.animations.showModal.waitForRender perform:^{
234
-		[_modalManager showModal:newVc animated:newVc.getCurrentChild.options.animations.showModal.enable hasCustomAnimation:newVc.getCurrentChild.options.animations.showModal.hasCustomAnimation completion:^(NSString *componentId) {
233
+	[newVc.getCurrentChild waitForReactViewRender:newVc.getCurrentChild.resolveOptions.animations.showModal.waitForRender perform:^{
234
+		[_modalManager showModal:newVc animated:newVc.getCurrentChild.resolveOptions.animations.showModal.enable hasCustomAnimation:newVc.getCurrentChild.resolveOptions.animations.showModal.hasCustomAnimation completion:^(NSString *componentId) {
235 235
 			[_eventEmitter sendOnNavigationCommandCompletion:showModal params:@{@"layout": layout}];
236 236
 			completion(componentId);
237 237
 		}];
@@ -249,7 +249,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
249 249
 	}
250 250
 	
251 251
 	RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
252
-	[modalToDismiss.getCurrentChild.options overrideOptions:options];
252
+	[modalToDismiss.getCurrentChild overrideOptions:options];
253 253
 	
254 254
 	[self removePopedViewControllers:modalToDismiss.navigationController.viewControllers];
255 255
 	

+ 9
- 15
lib/ios/RNNControllerFactory.m Datei anzeigen

@@ -105,9 +105,9 @@
105 105
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
106 106
 	
107 107
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
108
-	[presenter setDefaultOptions:_defaultOptions];
108
+
109 109
 	
110
-	RNNRootViewController* component = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:_creator eventEmitter:_eventEmitter presenter:presenter options:options];
110
+	RNNRootViewController* component = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:_creator eventEmitter:_eventEmitter presenter:presenter options:options defaultOptions:_defaultOptions];
111 111
 	
112 112
 	if (!component.isExternalViewController) {
113 113
 		CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
@@ -121,11 +121,10 @@
121 121
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
122 122
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
123 123
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
124
-	[presenter setDefaultOptions:_defaultOptions];
125 124
 	
126 125
 	UIViewController* externalVC = [_store getExternalComponent:layoutInfo bridge:_bridge];
127 126
 	
128
-	RNNRootViewController* component = [[RNNRootViewController alloc] initExternalComponentWithLayoutInfo:layoutInfo eventEmitter:_eventEmitter presenter:presenter options:options];
127
+	RNNRootViewController* component = [[RNNRootViewController alloc] initExternalComponentWithLayoutInfo:layoutInfo eventEmitter:_eventEmitter presenter:presenter options:options defaultOptions:_defaultOptions];
129 128
 	[component bindViewController:externalVC];
130 129
 	
131 130
 	return (UIViewController<RNNParentProtocol> *)component;
@@ -134,14 +133,13 @@
134 133
 
135 134
 - (UIViewController<RNNParentProtocol> *)createStack:(RNNLayoutNode*)node {
136 135
 	RNNNavigationControllerPresenter* presenter = [[RNNNavigationControllerPresenter alloc] init];
137
-	[presenter setDefaultOptions:_defaultOptions];
138 136
 	
139 137
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
140 138
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
141 139
 	
142 140
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
143 141
 	
144
-	RNNNavigationController* stack = [[RNNNavigationController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
142
+	RNNNavigationController* stack = [[RNNNavigationController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options defaultOptions:_defaultOptions presenter:presenter];
145 143
 	
146 144
 	return stack;
147 145
 }
@@ -150,11 +148,10 @@
150 148
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
151 149
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
152 150
 	RNNTabBarPresenter* presenter = [[RNNTabBarPresenter alloc] init];
153
-	[presenter setDefaultOptions:_defaultOptions];
154 151
 
155 152
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
156 153
 	
157
-	RNNTabBarController* tabsController = [[RNNTabBarController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter eventEmitter:_eventEmitter];
154
+	RNNTabBarController* tabsController = [[RNNTabBarController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options defaultOptions:_defaultOptions presenter:presenter eventEmitter:_eventEmitter];
158 155
 	
159 156
 	return tabsController;
160 157
 }
@@ -163,11 +160,10 @@
163 160
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
164 161
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
165 162
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
166
-	[presenter setDefaultOptions:_defaultOptions];
167 163
 
168 164
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
169 165
 	
170
-	RNNTopTabsViewController* topTabsController = [[RNNTopTabsViewController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
166
+	RNNTopTabsViewController* topTabsController = [[RNNTopTabsViewController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options defaultOptions:_defaultOptions presenter:presenter];
171 167
 	
172 168
 	return topTabsController;
173 169
 }
@@ -176,11 +172,10 @@
176 172
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
177 173
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
178 174
 	RNNSideMenuPresenter* presenter = [[RNNSideMenuPresenter alloc] init];
179
-	[presenter setDefaultOptions:_defaultOptions];
180 175
 
181 176
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
182 177
 	
183
-	RNNSideMenuController *sideMenu = [[RNNSideMenuController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
178
+	RNNSideMenuController *sideMenu = [[RNNSideMenuController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options defaultOptions:_defaultOptions presenter:presenter];
184 179
 	
185 180
 	return sideMenu;
186 181
 }
@@ -191,7 +186,7 @@
191 186
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
192 187
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
193 188
 
194
-	RNNSideMenuChildVC *sideMenuChild = [[RNNSideMenuChildVC alloc] initWithLayoutInfo:layoutInfo childViewControllers:@[childVc] options:options presenter:[[RNNViewControllerPresenter alloc] init] type:type];
189
+	RNNSideMenuChildVC *sideMenuChild = [[RNNSideMenuChildVC alloc] initWithLayoutInfo:layoutInfo childViewControllers:@[childVc] options:options defaultOptions:_defaultOptions presenter:[[RNNViewControllerPresenter alloc] init] type:type];
195 190
 	
196 191
 	return sideMenuChild;
197 192
 }
@@ -200,11 +195,10 @@
200 195
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
201 196
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
202 197
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
203
-	[presenter setDefaultOptions:_defaultOptions];
204 198
 
205 199
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
206 200
 
207
-	RNNSplitViewController* splitViewController = [[RNNSplitViewController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
201
+	RNNSplitViewController* splitViewController = [[RNNSplitViewController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options defaultOptions:_defaultOptions presenter:presenter];
208 202
 
209 203
 	return splitViewController;
210 204
 }

+ 2
- 2
lib/ios/RNNDefaultOptionsHelper.m Datei anzeigen

@@ -4,11 +4,11 @@
4 4
 
5 5
 + (void)recrusivelySetDefaultOptions:(RNNNavigationOptions *)defaultOptions onRootViewController:(UIViewController *)rootViewController {
6 6
 	if ([rootViewController conformsToProtocol:@protocol(RNNLayoutProtocol)])
7
-		[((UIViewController<RNNLayoutProtocol> *)rootViewController).presenter setDefaultOptions:defaultOptions];
7
+		[((UIViewController<RNNLayoutProtocol> *)rootViewController) setDefaultOptions:defaultOptions];
8 8
 	
9 9
 	for (UIViewController<RNNLayoutProtocol>* childViewController in rootViewController.childViewControllers) {
10 10
 		if ([childViewController conformsToProtocol:@protocol(RNNLayoutProtocol)]) {
11
-			[childViewController.presenter setDefaultOptions:defaultOptions];
11
+			[childViewController setDefaultOptions:defaultOptions];
12 12
 		}
13 13
 		
14 14
 		[self recrusivelySetDefaultOptions:defaultOptions onRootViewController:childViewController];

+ 5
- 0
lib/ios/RNNLayoutProtocol.h Datei anzeigen

@@ -9,6 +9,7 @@
9 9
 @property (nonatomic, retain) RNNBasePresenter* presenter;
10 10
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
11 11
 @property (nonatomic, strong) RNNNavigationOptions* options;
12
+@property (nonatomic, strong) RNNNavigationOptions* defaultOptions;
12 13
 
13 14
 - (UIViewController<RNNLeafProtocol, RNNLayoutProtocol> *)getCurrentChild;
14 15
 
@@ -16,4 +17,8 @@
16 17
 
17 18
 - (RNNNavigationOptions *)resolveOptions;
18 19
 
20
+- (void)setDefaultOptions:(RNNNavigationOptions *)defaultOptions;
21
+
22
+- (void)overrideOptions:(RNNNavigationOptions *)options;
23
+
19 24
 @end

+ 2
- 2
lib/ios/RNNModalManager.m Datei anzeigen

@@ -60,7 +60,7 @@
60 60
 
61 61
 -(void)removePendingNextModalIfOnTop:(RNNTransitionCompletionBlock)completion {
62 62
 	UIViewController<RNNParentProtocol> *modalToDismiss = [_pendingModalIdsToDismiss lastObject];
63
-	RNNNavigationOptions* options = modalToDismiss.getCurrentChild.options;
63
+	RNNNavigationOptions* options = modalToDismiss.getCurrentChild.resolveOptions;
64 64
 
65 65
 	if(!modalToDismiss) {
66 66
 		return;
@@ -88,7 +88,7 @@
88 88
 	} else {
89 89
 		[modalToDismiss.view removeFromSuperview];
90 90
 		modalToDismiss.view = nil;
91
-		modalToDismiss.getCurrentChild.options.animations.dismissModal.enable = NO;
91
+		modalToDismiss.getCurrentChild.resolveOptions.animations.dismissModal.enable = NO;
92 92
 		[self dismissedModal:modalToDismiss];
93 93
 		
94 94
 		if (completion) {

+ 1
- 0
lib/ios/RNNNavigationController.h Datei anzeigen

@@ -8,6 +8,7 @@
8 8
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
9 9
 @property (nonatomic, retain) RNNNavigationControllerPresenter* presenter;
10 10
 @property (nonatomic, strong) RNNNavigationOptions* options;
11
+@property (nonatomic, strong) RNNNavigationOptions* defaultOptions;
11 12
 
12 13
 - (void)setTopBarBackgroundColor:(UIColor *)backgroundColor;
13 14
 

+ 13
- 7
lib/ios/RNNNavigationController.m Datei anzeigen

@@ -13,11 +13,13 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
13 13
 
14 14
 @implementation RNNNavigationController
15 15
 
16
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNNavigationControllerPresenter *)presenter {
16
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions presenter:(RNNNavigationControllerPresenter *)presenter {
17 17
 	self = [super init];
18 18
 
19 19
 	self.presenter = presenter;
20 20
 	[self.presenter bindViewController:self];
21
+	
22
+	self.defaultOptions = defaultOptions;
21 23
 	self.options = options;
22 24
 	
23 25
 	self.layoutInfo = layoutInfo;
@@ -29,7 +31,7 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
29 31
 
30 32
 - (void)willMoveToParentViewController:(UIViewController *)parent {
31 33
 	if (parent) {
32
-		[_presenter applyOptionsOnWillMoveToParentViewController:self.options];
34
+		[_presenter applyOptionsOnWillMoveToParentViewController:self.resolveOptions];
33 35
 	}
34 36
 }
35 37
 
@@ -39,14 +41,18 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
39 41
 }
40 42
 
41 43
 - (RNNNavigationOptions *)resolveOptions {
42
-	return (RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options];
44
+	return [(RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options] withDefault:self.defaultOptions];
43 45
 }
44 46
 
45 47
 - (void)mergeOptions:(RNNNavigationOptions *)options {
46
-	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
48
+	[_presenter mergeOptions:options currentOptions:self.options defaultOptions:self.defaultOptions];
47 49
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
48 50
 }
49 51
 
52
+- (void)overrideOptions:(RNNNavigationOptions *)options {
53
+	[self.options overrideOptions:options];
54
+}
55
+
50 56
 - (UITabBarItem *)tabBarItem {
51 57
 	return self.viewControllers.firstObject.tabBarItem;
52 58
 }
@@ -72,7 +78,7 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
72 78
 		UIViewController *controller = self.viewControllers[self.viewControllers.count - 2];
73 79
 		if ([controller isKindOfClass:[RNNRootViewController class]]) {
74 80
 			RNNRootViewController *rnnController = (RNNRootViewController *)controller;
75
-			[self setTopBarBackgroundColor:[rnnController.options.topBar.background.color getWithDefaultValue:nil]];
81
+			[self setTopBarBackgroundColor:[rnnController.resolveOptions.topBar.background.color getWithDefaultValue:nil]];
76 82
 		}
77 83
 	}
78 84
 	
@@ -80,11 +86,11 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
80 86
 }
81 87
 
82 88
 - (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
83
-	return [[RNNModalAnimation alloc] initWithScreenTransition:self.getCurrentChild.options.animations.showModal isDismiss:NO];
89
+	return [[RNNModalAnimation alloc] initWithScreenTransition:self.getCurrentChild.resolveOptions.animations.showModal isDismiss:NO];
84 90
 }
85 91
 
86 92
 - (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
87
-	return [[RNNModalAnimation alloc] initWithScreenTransition:self.getCurrentChild.options.animations.dismissModal isDismiss:YES];
93
+	return [[RNNModalAnimation alloc] initWithScreenTransition:self.getCurrentChild.resolveOptions.animations.dismissModal isDismiss:YES];
88 94
 }
89 95
 
90 96
 - (UIViewController *)getCurrentChild {

+ 34
- 37
lib/ios/RNNNavigationControllerPresenter.m Datei anzeigen

@@ -5,10 +5,8 @@
5 5
 
6 6
 @implementation RNNNavigationControllerPresenter
7 7
 
8
-- (void)applyOptions:(RNNNavigationOptions *)initialOptions {
9
-	[super applyOptions:initialOptions];
10
-	RNNNavigationOptions* options = [initialOptions withDefault:self.defaultOptions];
11
-	
8
+- (void)applyOptions:(RNNNavigationOptions *)options {
9
+	[super applyOptions:options];
12 10
 	
13 11
 	RNNNavigationController* navigationController = self.bindedViewController;
14 12
 	
@@ -37,72 +35,71 @@
37 35
 	[navigationController rnn_setBackButtonIcon:[options.topBar.backButton.icon getWithDefaultValue:nil] withColor:[options.topBar.backButton.color getWithDefaultValue:nil] title:[options.topBar.backButton.showTitle getWithDefaultValue:YES] ? [options.topBar.backButton.title getWithDefaultValue:nil] : @""];
38 36
 }
39 37
 
40
-- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
41
-	[super mergeOptions:options resolvedOptions:resolvedOptions];
38
+- (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions defaultOptions:(RNNNavigationOptions *)defaultOptions {
39
+	[super mergeOptions:newOptions currentOptions:currentOptions defaultOptions:defaultOptions];
42 40
 	
43 41
 	RNNNavigationController* navigationController = self.bindedViewController;
44
-	RNNNavigationOptions* withDefault = (RNNNavigationOptions *)[options withDefault:self.defaultOptions];
45 42
 	
46
-	if (options.popGesture.hasValue) {
47
-		[navigationController rnn_setInteractivePopGestureEnabled:withDefault.popGesture.get];
43
+	if (newOptions.popGesture.hasValue) {
44
+		[navigationController rnn_setInteractivePopGestureEnabled:newOptions.popGesture.get];
48 45
 	}
49 46
 	
50
-	if (options.rootBackgroundImage.hasValue) {
51
-		[navigationController rnn_setRootBackgroundImage:withDefault.rootBackgroundImage.get];
47
+	if (newOptions.rootBackgroundImage.hasValue) {
48
+		[navigationController rnn_setRootBackgroundImage:newOptions.rootBackgroundImage.get];
52 49
 	}
53 50
 	
54
-	if (options.topBar.testID.hasValue) {
55
-		[navigationController rnn_setNavigationBarTestID:withDefault.topBar.testID.get];
51
+	if (newOptions.topBar.testID.hasValue) {
52
+		[navigationController rnn_setNavigationBarTestID:newOptions.topBar.testID.get];
56 53
 	}
57 54
 	
58
-	if (options.topBar.visible.hasValue) {
59
-		[navigationController rnn_setNavigationBarVisible:withDefault.topBar.visible.get animated:[withDefault.topBar.animate getWithDefaultValue:YES]];
55
+	if (newOptions.topBar.visible.hasValue) {
56
+		[navigationController rnn_setNavigationBarVisible:newOptions.topBar.visible.get animated:[newOptions.topBar.animate getWithDefaultValue:YES]];
60 57
 	}
61 58
 	
62
-	if (options.topBar.hideOnScroll.hasValue) {
63
-		[navigationController rnn_hideBarsOnScroll:[withDefault.topBar.hideOnScroll get]];
59
+	if (newOptions.topBar.hideOnScroll.hasValue) {
60
+		[navigationController rnn_hideBarsOnScroll:[newOptions.topBar.hideOnScroll get]];
64 61
 	}
65 62
 	
66
-	if (options.topBar.noBorder.hasValue) {
67
-		[navigationController rnn_setNavigationBarNoBorder:[withDefault.topBar.noBorder get]];
63
+	if (newOptions.topBar.noBorder.hasValue) {
64
+		[navigationController rnn_setNavigationBarNoBorder:[newOptions.topBar.noBorder get]];
68 65
 	}
69 66
 	
70
-	if (options.topBar.barStyle.hasValue) {
71
-		[navigationController rnn_setBarStyle:[RCTConvert UIBarStyle:withDefault.topBar.barStyle.get]];
67
+	if (newOptions.topBar.barStyle.hasValue) {
68
+		[navigationController rnn_setBarStyle:[RCTConvert UIBarStyle:newOptions.topBar.barStyle.get]];
72 69
 	}
73 70
 	
74
-	if (options.topBar.background.translucent.hasValue) {
75
-		[navigationController rnn_setNavigationBarTranslucent:[withDefault.topBar.background.translucent get]];
71
+	if (newOptions.topBar.background.translucent.hasValue) {
72
+		[navigationController rnn_setNavigationBarTranslucent:[newOptions.topBar.background.translucent get]];
76 73
 	}
77 74
 	
78
-	if (options.topBar.background.clipToBounds.hasValue) {
79
-		[navigationController rnn_setNavigationBarClipsToBounds:[withDefault.topBar.background.clipToBounds get]];
75
+	if (newOptions.topBar.background.clipToBounds.hasValue) {
76
+		[navigationController rnn_setNavigationBarClipsToBounds:[newOptions.topBar.background.clipToBounds get]];
80 77
 	}
81 78
 	
82
-	if (options.topBar.background.blur.hasValue) {
83
-		[navigationController rnn_setNavigationBarBlur:[withDefault.topBar.background.blur get]];
79
+	if (newOptions.topBar.background.blur.hasValue) {
80
+		[navigationController rnn_setNavigationBarBlur:[newOptions.topBar.background.blur get]];
84 81
 	}
85 82
 	
86
-	if (options.topBar.background.color.hasValue) {
87
-		[navigationController setTopBarBackgroundColor:withDefault.topBar.background.color.get];
83
+	if (newOptions.topBar.background.color.hasValue) {
84
+		[navigationController setTopBarBackgroundColor:newOptions.topBar.background.color.get];
88 85
 	}
89 86
 	
90
-	if (options.topBar.largeTitle.visible.hasValue) {
91
-		[navigationController rnn_setNavigationBarLargeTitleVisible:withDefault.topBar.largeTitle.visible.get];
87
+	if (newOptions.topBar.largeTitle.visible.hasValue) {
88
+		[navigationController rnn_setNavigationBarLargeTitleVisible:newOptions.topBar.largeTitle.visible.get];
92 89
 	}
93 90
 	
94
-	if (options.topBar.backButton.icon.hasValue) {
95
-		[navigationController rnn_setBackButtonIcon:[withDefault.topBar.backButton.icon getWithDefaultValue:nil] withColor:[withDefault.topBar.backButton.color getWithDefaultValue:nil] title:[withDefault.topBar.backButton.showTitle getWithDefaultValue:YES] ? [withDefault.topBar.backButton.title getWithDefaultValue:nil] : @""];
91
+	if (newOptions.topBar.backButton.icon.hasValue) {
92
+		[navigationController rnn_setBackButtonIcon:[newOptions.topBar.backButton.icon getWithDefaultValue:nil] withColor:[newOptions.topBar.backButton.color getWithDefaultValue:nil] title:[newOptions.topBar.backButton.showTitle getWithDefaultValue:YES] ? [newOptions.topBar.backButton.title getWithDefaultValue:nil] : @""];
96 93
 		
97 94
 	}
98 95
 	
99
-	if (options.topBar.backButton.color.hasValue) {
100
-		[navigationController rnn_setBackButtonColor:options.topBar.backButton.color.get];
96
+	if (newOptions.topBar.backButton.color.hasValue) {
97
+		[navigationController rnn_setBackButtonColor:newOptions.topBar.backButton.color.get];
101 98
 	}
102 99
 	
103
-	[navigationController rnn_setNavigationBarLargeTitleFontFamily:[withDefault.topBar.largeTitle.fontFamily getWithDefaultValue:nil] fontSize:[withDefault.topBar.largeTitle.fontSize getWithDefaultValue:nil] color:[withDefault.topBar.largeTitle.color getWithDefaultValue:nil]];
100
+	[navigationController rnn_setNavigationBarLargeTitleFontFamily:[newOptions.topBar.largeTitle.fontFamily getWithDefaultValue:nil] fontSize:[newOptions.topBar.largeTitle.fontSize getWithDefaultValue:nil] color:[newOptions.topBar.largeTitle.color getWithDefaultValue:nil]];
104 101
 	
105
-	[navigationController rnn_setNavigationBarFontFamily:[withDefault.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[withDefault.topBar.title.fontSize getWithDefaultValue:nil] color:[withDefault.topBar.title.color getWithDefaultValue:nil]];
102
+	[navigationController rnn_setNavigationBarFontFamily:[newOptions.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[newOptions.topBar.title.fontSize getWithDefaultValue:nil] color:[newOptions.topBar.title.color getWithDefaultValue:nil]];
106 103
 	
107 104
 }
108 105
 

+ 1
- 1
lib/ios/RNNParentProtocol.h Datei anzeigen

@@ -5,7 +5,7 @@
5 5
 
6 6
 @required
7 7
 
8
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNBasePresenter *)presenter;
8
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions presenter:(RNNBasePresenter *)presenter;
9 9
 
10 10
 - (void)onChildWillAppear;
11 11
 

+ 7
- 3
lib/ios/RNNRootViewController.h Datei anzeigen

@@ -17,6 +17,7 @@ typedef void (^PreviewCallback)(UIViewController *vc);
17 17
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
18 18
 @property (nonatomic, strong) RNNViewControllerPresenter* presenter;
19 19
 @property (nonatomic, strong) RNNNavigationOptions* options;
20
+@property (nonatomic, strong) RNNNavigationOptions* defaultOptions;
20 21
 
21 22
 @property (nonatomic) id<RNNRootViewCreator> creator;
22 23
 @property (nonatomic, strong) RNNAnimator* animator;
@@ -27,15 +28,18 @@ typedef void (^PreviewCallback)(UIViewController *vc);
27 28
 				   rootViewCreator:(id<RNNRootViewCreator>)creator
28 29
 					  eventEmitter:(RNNEventEmitter*)eventEmitter
29 30
 						 presenter:(RNNViewControllerPresenter *)presenter
30
-						   options:(RNNNavigationOptions *)options;
31
+						   options:(RNNNavigationOptions *)options
32
+					defaultOptions:(RNNNavigationOptions *)defaultOptions;
31 33
 
32 34
 - (instancetype)initExternalComponentWithLayoutInfo:(RNNLayoutInfo *)layoutInfo
33 35
 									   eventEmitter:(RNNEventEmitter*)eventEmitter
34 36
 										  presenter:(RNNViewControllerPresenter *)presenter
35
-											options:(RNNNavigationOptions *)options;
37
+											options:(RNNNavigationOptions *)options
38
+									 defaultOptions:(RNNNavigationOptions *)defaultOptions;
36 39
 
37 40
 - (BOOL)isExternalViewController;
38 41
 
39
--(void)onButtonPress:(RNNUIBarButtonItem *)barButtonItem;
42
+- (void)onButtonPress:(RNNUIBarButtonItem *)barButtonItem;
43
+
40 44
 
41 45
 @end

+ 39
- 37
lib/ios/RNNRootViewController.m Datei anzeigen

@@ -22,7 +22,7 @@
22 22
 
23 23
 @synthesize previewCallback;
24 24
 
25
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo rootViewCreator:(id<RNNRootViewCreator>)creator eventEmitter:(RNNEventEmitter *)eventEmitter presenter:(RNNViewControllerPresenter *)presenter options:(RNNNavigationOptions *)options {
25
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo rootViewCreator:(id<RNNRootViewCreator>)creator eventEmitter:(RNNEventEmitter *)eventEmitter presenter:(RNNViewControllerPresenter *)presenter options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions {
26 26
 	self = [super init];
27 27
 	
28 28
 	self.layoutInfo = layoutInfo;
@@ -39,9 +39,11 @@
39 39
 	self.presenter = presenter;
40 40
 	[self.presenter bindViewController:self];
41 41
 	self.options = options;
42
-	[self.presenter applyOptionsOnInit:self.options];
42
+	self.defaultOptions = defaultOptions;
43 43
 	
44
-	self.animator = [[RNNAnimator alloc] initWithTransitionOptions:self.optionsWithDefault.customTransition];
44
+	[self.presenter applyOptionsOnInit:self.resolveOptions];
45
+	
46
+	self.animator = [[RNNAnimator alloc] initWithTransitionOptions:self.resolveOptions.customTransition];
45 47
 	
46 48
 	[[NSNotificationCenter defaultCenter] addObserver:self
47 49
 											 selector:@selector(onJsReload)
@@ -52,8 +54,8 @@
52 54
 	return self;
53 55
 }
54 56
 
55
-- (instancetype)initExternalComponentWithLayoutInfo:(RNNLayoutInfo *)layoutInfo eventEmitter:(RNNEventEmitter *)eventEmitter presenter:(RNNViewControllerPresenter *)presenter options:(RNNNavigationOptions *)options {
56
-	self = [self initWithLayoutInfo:layoutInfo rootViewCreator:nil eventEmitter:eventEmitter presenter:presenter options:options];
57
+- (instancetype)initExternalComponentWithLayoutInfo:(RNNLayoutInfo *)layoutInfo eventEmitter:(RNNEventEmitter *)eventEmitter presenter:(RNNViewControllerPresenter *)presenter options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions {
58
+	self = [self initWithLayoutInfo:layoutInfo rootViewCreator:nil eventEmitter:eventEmitter presenter:presenter options:options defaultOptions:defaultOptions];
57 59
 	return self;
58 60
 }
59 61
 
@@ -65,29 +67,33 @@
65 67
 
66 68
 - (void)willMoveToParentViewController:(UIViewController *)parent {
67 69
 	if (parent) {
68
-		[_presenter applyOptionsOnWillMoveToParentViewController:self.options];
70
+		[_presenter applyOptionsOnWillMoveToParentViewController:self.resolveOptions];
69 71
 	}
70 72
 }
71 73
 
72 74
 - (void)mergeOptions:(RNNNavigationOptions *)options {
73
-	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
75
+	[_presenter mergeOptions:options currentOptions:self.options defaultOptions:self.defaultOptions];
74 76
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
75 77
 	
76 78
 	[self initCustomViews];
77 79
 }
78 80
 
79
--(void)viewWillAppear:(BOOL)animated{
81
+- (void)overrideOptions:(RNNNavigationOptions *)options {
82
+	[self.options overrideOptions:options];
83
+}
84
+
85
+- (void)viewWillAppear:(BOOL)animated{
80 86
 	[super viewWillAppear:animated];
81 87
 	_isBeingPresented = YES;
82 88
 	
83
-	[_presenter applyOptions:self.options];
89
+	[_presenter applyOptions:self.resolveOptions];
84 90
 	[((UIViewController<RNNParentProtocol> *)self.parentViewController) onChildWillAppear];
85 91
 	
86 92
 	[self initCustomViews];
87 93
 }
88 94
 
89 95
 - (RNNNavigationOptions *)resolveOptions {
90
-	return self.options;
96
+	return [self.options withDefault:self.defaultOptions];
91 97
 }
92 98
 
93 99
 -(void)viewDidAppear:(BOOL)animated {
@@ -156,18 +162,18 @@
156 162
 }
157 163
 
158 164
 - (void)setTitleViewWithSubtitle {
159
-	if (self.optionsWithDefault.topBar.subtitle.text.hasValue) {
160
-		RNNTitleViewHelper* titleViewHelper = [[RNNTitleViewHelper alloc] initWithTitleViewOptions:self.optionsWithDefault.topBar.title subTitleOptions:self.optionsWithDefault.topBar.subtitle viewController:self];
165
+	if (self.resolveOptions.topBar.subtitle.text.hasValue) {
166
+		RNNTitleViewHelper* titleViewHelper = [[RNNTitleViewHelper alloc] initWithTitleViewOptions:self.resolveOptions.topBar.title subTitleOptions:self.resolveOptions.topBar.subtitle viewController:self];
161 167
 		[titleViewHelper setup];
162 168
 	}
163 169
 }
164 170
 
165 171
 - (void)setCustomNavigationTitleView {
166 172
 	if (!_customTitleView && _isBeingPresented) {
167
-		if (self.optionsWithDefault.topBar.title.component.name.hasValue) {
168
-			_customTitleView = (RNNReactView*)[_creator createRootViewFromComponentOptions:self.optionsWithDefault.topBar.title.component];
173
+		if (self.resolveOptions.topBar.title.component.name.hasValue) {
174
+			_customTitleView = (RNNReactView*)[_creator createRootViewFromComponentOptions:self.resolveOptions.topBar.title.component];
169 175
 			_customTitleView.backgroundColor = UIColor.clearColor;
170
-			NSString* alignment = [self.optionsWithDefault.topBar.title.component.alignment getWithDefaultValue:@""];
176
+			NSString* alignment = [self.resolveOptions.topBar.title.component.alignment getWithDefaultValue:@""];
171 177
 			[_customTitleView setAlignment:alignment];
172 178
 			BOOL isCenter = [alignment isEqualToString:@"center"];
173 179
 			__weak RNNReactView *weakTitleView = _customTitleView;
@@ -193,8 +199,8 @@
193 199
 
194 200
 - (void)setCustomNavigationBarView {
195 201
 	if (!_customTopBar) {
196
-		if (self.optionsWithDefault.topBar.component.name.hasValue) {
197
-			RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.optionsWithDefault.topBar.component];
202
+		if (self.resolveOptions.topBar.component.name.hasValue) {
203
+			RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.resolveOptions.topBar.component];
198 204
 			
199 205
 			_customTopBar = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
200 206
 			reactView.backgroundColor = UIColor.clearColor;
@@ -213,8 +219,8 @@
213 219
 
214 220
 - (void)setCustomNavigationComponentBackground {
215 221
 	if (!_customTopBarBackground) {
216
-		if (self.optionsWithDefault.topBar.background.component.name.hasValue) {
217
-			RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.optionsWithDefault.topBar.background.component];
222
+		if (self.resolveOptions.topBar.background.component.name.hasValue) {
223
+			RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.resolveOptions.topBar.background.component];
218 224
 			
219 225
 			_customTopBarBackground = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
220 226
 			[self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
@@ -230,12 +236,8 @@
230 236
 	}
231 237
 }
232 238
 
233
-- (RNNNavigationOptions *)optionsWithDefault {
234
-	return (RNNNavigationOptions *)[[self.options copy] withDefault:_presenter.defaultOptions];
235
-}
236
-
237 239
 -(BOOL)isCustomTransitioned {
238
-	return self.optionsWithDefault.customTransition.animations != nil;
240
+	return self.resolveOptions.customTransition.animations != nil;
239 241
 }
240 242
 
241 243
 - (BOOL)isExternalViewController {
@@ -243,9 +245,9 @@
243 245
 }
244 246
 
245 247
 - (BOOL)prefersStatusBarHidden {
246
-	if (self.optionsWithDefault.statusBar.visible.hasValue) {
247
-		return ![self.optionsWithDefault.statusBar.visible get];
248
-	} else if ([self.optionsWithDefault.statusBar.hideWithTopBar getWithDefaultValue:NO]) {
248
+	if (self.resolveOptions.statusBar.visible.hasValue) {
249
+		return ![self.resolveOptions.statusBar.visible get];
250
+	} else if ([self.resolveOptions.statusBar.hideWithTopBar getWithDefaultValue:NO]) {
249 251
 		return self.navigationController.isNavigationBarHidden;
250 252
 	}
251 253
 	
@@ -253,7 +255,7 @@
253 255
 }
254 256
 
255 257
 - (UIStatusBarStyle)preferredStatusBarStyle {
256
-	if ([[self.optionsWithDefault.statusBar.style getWithDefaultValue:@"default"] isEqualToString:@"light"]) {
258
+	if ([[self.resolveOptions.statusBar.style getWithDefaultValue:@"default"] isEqualToString:@"light"]) {
257 259
 		return UIStatusBarStyleLightContent;
258 260
 	} else {
259 261
 		return UIStatusBarStyleDefault;
@@ -261,12 +263,12 @@
261 263
 }
262 264
 
263 265
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
264
-	return self.optionsWithDefault.layout.supportedOrientations;
266
+	return self.resolveOptions.layout.supportedOrientations;
265 267
 }
266 268
 
267 269
 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
268 270
 	RNNRootViewController* vc =  (RNNRootViewController*)viewController;
269
-	if (![[vc.optionsWithDefault.topBar.backButton.transition getWithDefaultValue:@""] isEqualToString:@"custom"]){
271
+	if (![[vc.self.resolveOptions.topBar.backButton.transition getWithDefaultValue:@""] isEqualToString:@"custom"]){
270 272
 		navigationController.delegate = nil;
271 273
 	}
272 274
 }
@@ -277,10 +279,10 @@
277 279
 												 toViewController:(UIViewController*)toVC {
278 280
 	if (self.animator) {
279 281
 		return self.animator;
280
-	} else if (operation == UINavigationControllerOperationPush && self.optionsWithDefault.animations.push.hasCustomAnimation) {
281
-		return [[RNNPushAnimation alloc] initWithScreenTransition:self.optionsWithDefault.animations.push];
282
-	} else if (operation == UINavigationControllerOperationPop && self.optionsWithDefault.animations.pop.hasCustomAnimation) {
283
-		return [[RNNPushAnimation alloc] initWithScreenTransition:self.optionsWithDefault.animations.pop];
282
+	} else if (operation == UINavigationControllerOperationPush && self.resolveOptions.animations.push.hasCustomAnimation) {
283
+		return [[RNNPushAnimation alloc] initWithScreenTransition:self.resolveOptions.animations.push];
284
+	} else if (operation == UINavigationControllerOperationPop && self.resolveOptions.animations.pop.hasCustomAnimation) {
285
+		return [[RNNPushAnimation alloc] initWithScreenTransition:self.resolveOptions.animations.pop];
284 286
 	} else {
285 287
 		return nil;
286 288
 	}
@@ -289,11 +291,11 @@
289 291
 }
290 292
 
291 293
 - (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
292
-	return [[RNNModalAnimation alloc] initWithScreenTransition:self.optionsWithDefault.animations.showModal isDismiss:NO];
294
+	return [[RNNModalAnimation alloc] initWithScreenTransition:self.resolveOptions.animations.showModal isDismiss:NO];
293 295
 }
294 296
 
295 297
 - (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
296
-	return [[RNNModalAnimation alloc] initWithScreenTransition:self.optionsWithDefault.animations.dismissModal isDismiss:YES];
298
+	return [[RNNModalAnimation alloc] initWithScreenTransition:self.resolveOptions.animations.dismissModal isDismiss:YES];
297 299
 }
298 300
 
299 301
 - (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location{
@@ -328,7 +330,7 @@
328 330
 
329 331
 - (NSArray<id<UIPreviewActionItem>> *)previewActionItems {
330 332
 	NSMutableArray *actions = [[NSMutableArray alloc] init];
331
-	for (NSDictionary *previewAction in self.options.preview.actions) {
333
+	for (NSDictionary *previewAction in self.resolveOptions.preview.actions) {
332 334
 		UIPreviewAction *action = [self convertAction:previewAction];
333 335
 		NSDictionary *actionActions = previewAction[@"actions"];
334 336
 		if (actionActions.count > 0) {

+ 2
- 1
lib/ios/RNNSideMenuChildVC.h Datei anzeigen

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

+ 10
- 6
lib/ios/RNNSideMenuChildVC.m Datei anzeigen

@@ -9,15 +9,15 @@
9 9
 
10 10
 @implementation RNNSideMenuChildVC
11 11
 
12
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNViewControllerPresenter *)presenter type:(RNNSideMenuChildType)type {
13
-	self = [self initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
12
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions presenter:(RNNViewControllerPresenter *)presenter type:(RNNSideMenuChildType)type {
13
+	self = [self initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options defaultOptions:defaultOptions 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 presenter:(RNNViewControllerPresenter *)presenter {
20
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions presenter:(RNNViewControllerPresenter *)presenter {
21 21
 	self = [super init];
22 22
 	
23 23
 	self.child = childViewControllers[0];
@@ -25,7 +25,7 @@
25 25
 	self.presenter = presenter;
26 26
 	[self.presenter bindViewController:self];
27 27
 	
28
-	
28
+	self.defaultOptions = defaultOptions;
29 29
 	self.options = options;
30 30
 	self.layoutInfo = layoutInfo;
31 31
 	
@@ -40,14 +40,18 @@
40 40
 }
41 41
 
42 42
 - (RNNNavigationOptions *)resolveOptions {
43
-	return (RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options];
43
+	return [(RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options] withDefault:self.defaultOptions];
44 44
 }
45 45
 
46 46
 - (void)mergeOptions:(RNNNavigationOptions *)options {
47
-	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
47
+	[_presenter mergeOptions:options currentOptions:self.options defaultOptions:self.defaultOptions];
48 48
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
49 49
 }
50 50
 
51
+- (void)overrideOptions:(RNNNavigationOptions *)options {
52
+	[self.options overrideOptions:options];
53
+}
54
+
51 55
 - (UITabBarItem *)tabBarItem {
52 56
 	return self.child.tabBarItem;
53 57
 }

+ 1
- 0
lib/ios/RNNSideMenuController.h Datei anzeigen

@@ -12,6 +12,7 @@
12 12
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
13 13
 @property (nonatomic, retain) RNNViewControllerPresenter* presenter;
14 14
 @property (nonatomic, strong) RNNNavigationOptions* options;
15
+@property (nonatomic, strong) RNNNavigationOptions* defaultOptions;
15 16
 
16 17
 - (void)side:(MMDrawerSide)side enabled:(BOOL)enabled;
17 18
 - (void)side:(MMDrawerSide)side visible:(BOOL)visible;

+ 9
- 4
lib/ios/RNNSideMenuController.m Datei anzeigen

@@ -13,13 +13,14 @@
13 13
 
14 14
 @implementation RNNSideMenuController
15 15
 
16
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNViewControllerPresenter *)presenter {
16
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions presenter:(RNNViewControllerPresenter *)presenter {
17 17
 	[self setControllers:childViewControllers];
18 18
 	self = [super initWithCenterViewController:self.center leftDrawerViewController:self.left rightDrawerViewController:self.right];
19 19
 	
20 20
 	self.presenter = presenter;
21 21
 	[self.presenter bindViewController:self];
22 22
 	
23
+	self.defaultOptions = defaultOptions;
23 24
 	self.options = options;
24 25
 	
25 26
 	self.layoutInfo = layoutInfo;
@@ -36,7 +37,7 @@
36 37
 
37 38
 - (void)willMoveToParentViewController:(UIViewController *)parent {
38 39
 	if (parent) {
39
-		[_presenter applyOptionsOnWillMoveToParentViewController:self.options];
40
+		[_presenter applyOptionsOnWillMoveToParentViewController:self.resolveOptions];
40 41
 	}
41 42
 }
42 43
 
@@ -50,14 +51,18 @@
50 51
 }
51 52
 
52 53
 - (RNNNavigationOptions *)resolveOptions {
53
-	return (RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options];
54
+	return [(RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options] withDefault:self.defaultOptions];
54 55
 }
55 56
 
56 57
 - (void)mergeOptions:(RNNNavigationOptions *)options {
57
-	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
58
+	[_presenter mergeOptions:options currentOptions:self.options defaultOptions:self.defaultOptions];
58 59
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
59 60
 }
60 61
 
62
+- (void)overrideOptions:(RNNNavigationOptions *)options {
63
+	[self.options overrideOptions:options];
64
+}
65
+
61 66
 - (void)setAnimationType:(NSString *)animationType {
62 67
 	MMDrawerControllerDrawerVisualStateBlock animationTypeStateBlock = nil;
63 68
 	if ([animationType isEqualToString:@"door"]) animationTypeStateBlock = [MMDrawerVisualState swingingDoorVisualStateBlock];

+ 31
- 33
lib/ios/RNNSideMenuPresenter.m Datei anzeigen

@@ -3,11 +3,9 @@
3 3
 
4 4
 @implementation RNNSideMenuPresenter
5 5
 
6
-- (void)applyOptions:(RNNNavigationOptions *)initialOptions {
7
-	[super applyOptions:initialOptions];
8
-	
9
-	RNNNavigationOptions* options = [initialOptions withDefault:self.defaultOptions];
10
-	
6
+- (void)applyOptions:(RNNNavigationOptions *)options {
7
+	[super applyOptions:options];
8
+		
11 9
 	RNNSideMenuController* sideMenuController = self.bindedViewController;
12 10
 	
13 11
 	[sideMenuController side:MMDrawerSideLeft enabled:[options.sideMenu.left.enabled getWithDefaultValue:YES]];
@@ -30,57 +28,57 @@
30 28
 	}
31 29
 }
32 30
 
33
-- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
34
-	[super mergeOptions:options resolvedOptions:resolvedOptions];
31
+- (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions defaultOptions:(RNNNavigationOptions *)defaultOptions {
32
+	[super mergeOptions:newOptions currentOptions:currentOptions defaultOptions:defaultOptions];
35 33
 	
36 34
 	RNNSideMenuController* sideMenuController = self.bindedViewController;
37 35
 	
38
-	if (options.sideMenu.left.enabled.hasValue) {
39
-		[sideMenuController side:MMDrawerSideLeft enabled:options.sideMenu.left.enabled.get];
40
-		[options.sideMenu.left.enabled consume];
36
+	if (newOptions.sideMenu.left.enabled.hasValue) {
37
+		[sideMenuController side:MMDrawerSideLeft enabled:newOptions.sideMenu.left.enabled.get];
38
+		[newOptions.sideMenu.left.enabled consume];
41 39
 	}
42 40
 	
43
-	if (options.sideMenu.right.enabled.hasValue) {
44
-		[sideMenuController side:MMDrawerSideRight enabled:options.sideMenu.right.enabled.get];
45
-		[options.sideMenu.right.enabled consume];
41
+	if (newOptions.sideMenu.right.enabled.hasValue) {
42
+		[sideMenuController side:MMDrawerSideRight enabled:newOptions.sideMenu.right.enabled.get];
43
+		[newOptions.sideMenu.right.enabled consume];
46 44
 	}
47 45
 	
48
-	if (options.sideMenu.left.visible.hasValue) {
49
-		[sideMenuController side:MMDrawerSideLeft visible:options.sideMenu.left.visible.get];
50
-		[options.sideMenu.left.visible consume];
46
+	if (newOptions.sideMenu.left.visible.hasValue) {
47
+		[sideMenuController side:MMDrawerSideLeft visible:newOptions.sideMenu.left.visible.get];
48
+		[newOptions.sideMenu.left.visible consume];
51 49
 	}
52 50
 	
53
-	if (options.sideMenu.right.visible.hasValue) {
54
-		[sideMenuController side:MMDrawerSideRight visible:options.sideMenu.right.visible.get];
55
-		[options.sideMenu.right.visible consume];
51
+	if (newOptions.sideMenu.right.visible.hasValue) {
52
+		[sideMenuController side:MMDrawerSideRight visible:newOptions.sideMenu.right.visible.get];
53
+		[newOptions.sideMenu.right.visible consume];
56 54
 	}
57 55
 	
58
-	if (options.sideMenu.left.width.hasValue) {
59
-		[sideMenuController side:MMDrawerSideLeft width:options.sideMenu.left.width.get];
56
+	if (newOptions.sideMenu.left.width.hasValue) {
57
+		[sideMenuController side:MMDrawerSideLeft width:newOptions.sideMenu.left.width.get];
60 58
 	}
61 59
 	
62
-	if (options.sideMenu.right.width.hasValue) {
63
-		[sideMenuController side:MMDrawerSideRight width:options.sideMenu.right.width.get];
60
+	if (newOptions.sideMenu.right.width.hasValue) {
61
+		[sideMenuController side:MMDrawerSideRight width:newOptions.sideMenu.right.width.get];
64 62
 	}
65 63
 	
66
-	if (options.sideMenu.left.shouldStretchDrawer.hasValue) {
67
-		sideMenuController.shouldStretchLeftDrawer = options.sideMenu.left.shouldStretchDrawer.get;
64
+	if (newOptions.sideMenu.left.shouldStretchDrawer.hasValue) {
65
+		sideMenuController.shouldStretchLeftDrawer = newOptions.sideMenu.left.shouldStretchDrawer.get;
68 66
 	}
69 67
 	
70
-	if (options.sideMenu.right.shouldStretchDrawer.hasValue) {
71
-		sideMenuController.shouldStretchRightDrawer = options.sideMenu.right.shouldStretchDrawer.get;
68
+	if (newOptions.sideMenu.right.shouldStretchDrawer.hasValue) {
69
+		sideMenuController.shouldStretchRightDrawer = newOptions.sideMenu.right.shouldStretchDrawer.get;
72 70
 	}
73 71
 	
74
-	if (options.sideMenu.left.animationVelocity.hasValue) {
75
-		sideMenuController.animationVelocityLeft = options.sideMenu.left.animationVelocity.get;
72
+	if (newOptions.sideMenu.left.animationVelocity.hasValue) {
73
+		sideMenuController.animationVelocityLeft = newOptions.sideMenu.left.animationVelocity.get;
76 74
 	}
77 75
 	
78
-	if (options.sideMenu.right.animationVelocity.hasValue) {
79
-		sideMenuController.animationVelocityRight = options.sideMenu.right.animationVelocity.get;
76
+	if (newOptions.sideMenu.right.animationVelocity.hasValue) {
77
+		sideMenuController.animationVelocityRight = newOptions.sideMenu.right.animationVelocity.get;
80 78
 	}
81 79
 	
82
-	if (options.sideMenu.animationType.hasValue) {
83
-		[sideMenuController setAnimationType:options.sideMenu.animationType.get];
80
+	if (newOptions.sideMenu.animationType.hasValue) {
81
+		[sideMenuController setAnimationType:newOptions.sideMenu.animationType.get];
84 82
 	}
85 83
 }
86 84
 

+ 1
- 0
lib/ios/RNNSplitViewController.h Datei anzeigen

@@ -12,6 +12,7 @@
12 12
 @interface RNNSplitViewController : UISplitViewController <RNNParentProtocol>
13 13
 
14 14
 @property (nonatomic, strong) RNNNavigationOptions* options;
15
+@property (nonatomic, strong) RNNNavigationOptions* defaultOptions;
15 16
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
16 17
 @property (nonatomic, retain) RNNViewControllerPresenter* presenter;
17 18
 

+ 8
- 3
lib/ios/RNNSplitViewController.m Datei anzeigen

@@ -2,12 +2,13 @@
2 2
 
3 3
 @implementation RNNSplitViewController
4 4
 
5
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNViewControllerPresenter *)presenter {
5
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions presenter:(RNNViewControllerPresenter *)presenter {
6 6
 	self = [super init];
7 7
 	
8 8
 	self.presenter = presenter;
9 9
 	[self.presenter bindViewController:self];
10 10
 	
11
+	self.defaultOptions = defaultOptions;
11 12
 	self.options = options;
12 13
 	self.layoutInfo = layoutInfo;
13 14
 	
@@ -24,14 +25,18 @@
24 25
 }
25 26
 
26 27
 - (RNNNavigationOptions *)resolveOptions {
27
-	return (RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options];
28
+	return [(RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options] withDefault:self.defaultOptions];
28 29
 }
29 30
 
30 31
 - (void)mergeOptions:(RNNNavigationOptions *)options {
31
-	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
32
+	[_presenter mergeOptions:options currentOptions:self.options defaultOptions:self.defaultOptions];
32 33
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
33 34
 }
34 35
 
36
+- (void)overrideOptions:(RNNNavigationOptions *)options {
37
+	[self.options overrideOptions:options];
38
+}
39
+
35 40
 - (void)bindChildViewControllers:(NSArray<UIViewController<RNNLayoutProtocol> *> *)viewControllers {
36 41
 	[self setViewControllers:viewControllers];
37 42
 	UIViewController<UISplitViewControllerDelegate>* masterViewController = viewControllers[0];

+ 2
- 1
lib/ios/RNNTabBarController.h Datei anzeigen

@@ -5,13 +5,14 @@
5 5
 
6 6
 @interface RNNTabBarController : UITabBarController <RNNParentProtocol, UITabBarControllerDelegate>
7 7
 
8
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNTabBarPresenter *)presenter eventEmitter:(RNNEventEmitter *)eventEmitter;
8
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions presenter:(RNNTabBarPresenter *)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) RNNTabBarPresenter* presenter;
14 14
 @property (nonatomic, strong) RNNNavigationOptions* options;
15
+@property (nonatomic, strong) RNNNavigationOptions* defaultOptions;
15 16
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
16 17
 
17 18
 @end

+ 11
- 4
lib/ios/RNNTabBarController.m Datei anzeigen

@@ -7,9 +7,10 @@
7 7
 - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo
8 8
 			  childViewControllers:(NSArray *)childViewControllers
9 9
 						   options:(RNNNavigationOptions *)options
10
+					defaultOptions:(RNNNavigationOptions *)defaultOptions
10 11
 						 presenter:(RNNTabBarPresenter *)presenter
11 12
 					  eventEmitter:(RNNEventEmitter *)eventEmitter {
12
-	self = [self initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
13
+	self = [self initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options defaultOptions:defaultOptions presenter:presenter];
13 14
 	
14 15
 	_eventEmitter = eventEmitter;
15 16
 	
@@ -19,11 +20,13 @@
19 20
 - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo
20 21
 			  childViewControllers:(NSArray *)childViewControllers
21 22
 						   options:(RNNNavigationOptions *)options
23
+					defaultOptions:(RNNNavigationOptions *)defaultOptions
22 24
 						 presenter:(RNNTabBarPresenter *)presenter {
23 25
 	self = [super init];
24 26
 	
25 27
 	self.delegate = self;
26 28
 	self.options = options;
29
+	self.defaultOptions = defaultOptions;
27 30
 	self.layoutInfo = layoutInfo;
28 31
 	self.presenter = presenter;
29 32
 	[self.presenter bindViewController:self];
@@ -34,7 +37,7 @@
34 37
 
35 38
 - (void)willMoveToParentViewController:(UIViewController *)parent {
36 39
 	if (parent) {
37
-		[_presenter applyOptionsOnWillMoveToParentViewController:self.options];
40
+		[_presenter applyOptionsOnWillMoveToParentViewController:self.resolveOptions];
38 41
 	}
39 42
 }
40 43
 
@@ -44,14 +47,18 @@
44 47
 }
45 48
 
46 49
 - (RNNNavigationOptions *)resolveOptions {
47
-	return (RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options];
50
+	return [(RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options] withDefault:self.defaultOptions];
48 51
 }
49 52
 
50 53
 - (void)mergeOptions:(RNNNavigationOptions *)options {
51
-	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
54
+	[_presenter mergeOptions:options currentOptions:self.options defaultOptions:self.defaultOptions];
52 55
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
53 56
 }
54 57
 
58
+- (void)overrideOptions:(RNNNavigationOptions *)options {
59
+	[self.options overrideOptions:options];
60
+}
61
+
55 62
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
56 63
 	return self.selectedViewController.supportedInterfaceOrientations;
57 64
 }

+ 21
- 25
lib/ios/RNNTabBarPresenter.m Datei anzeigen

@@ -3,11 +3,7 @@
3 3
 
4 4
 @implementation RNNTabBarPresenter
5 5
 
6
-- (void)applyOptions:(RNNNavigationOptions *)initialOptions {
7
-	[super applyOptions:initialOptions];
8
-	
9
-	RNNNavigationOptions* options = [initialOptions withDefault:self.defaultOptions];
10
-	
6
+- (void)applyOptions:(RNNNavigationOptions *)options {
11 7
 	UITabBarController* tabBarController = self.bindedViewController;
12 8
 	
13 9
 	[tabBarController rnn_setTabBarTestID:[options.bottomTabs.testID getWithDefaultValue:nil]];
@@ -18,43 +14,43 @@
18 14
 	[tabBarController rnn_setTabBarVisible:[options.bottomTabs.visible getWithDefaultValue:YES]];
19 15
 }
20 16
 
21
-- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
22
-	[super mergeOptions:options resolvedOptions:resolvedOptions];
17
+- (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions defaultOptions:(RNNNavigationOptions *)defaultOptions {
18
+	[super mergeOptions:newOptions currentOptions:currentOptions defaultOptions:defaultOptions];
23 19
 	
24 20
 	UITabBarController* tabBarController = self.bindedViewController;
25 21
 	
26
-	if (options.bottomTabs.currentTabIndex.hasValue) {
27
-		[tabBarController rnn_setCurrentTabIndex:options.bottomTabs.currentTabIndex.get];
28
-		[options.bottomTabs.currentTabIndex consume];
22
+	if (newOptions.bottomTabs.currentTabIndex.hasValue) {
23
+		[tabBarController rnn_setCurrentTabIndex:newOptions.bottomTabs.currentTabIndex.get];
24
+		[newOptions.bottomTabs.currentTabIndex consume];
29 25
 	}
30 26
 	
31
-	if (options.bottomTabs.currentTabId.hasValue) {
32
-		[tabBarController rnn_setCurrentTabID:options.bottomTabs.currentTabId.get];
33
-		[options.bottomTabs.currentTabId consume];
27
+	if (newOptions.bottomTabs.currentTabId.hasValue) {
28
+		[tabBarController rnn_setCurrentTabID:newOptions.bottomTabs.currentTabId.get];
29
+		[newOptions.bottomTabs.currentTabId consume];
34 30
 	}
35 31
 	
36
-	if (options.bottomTabs.testID.hasValue) {
37
-		[tabBarController rnn_setTabBarTestID:options.bottomTabs.testID.get];
32
+	if (newOptions.bottomTabs.testID.hasValue) {
33
+		[tabBarController rnn_setTabBarTestID:newOptions.bottomTabs.testID.get];
38 34
 	}
39 35
 	
40
-	if (options.bottomTabs.backgroundColor.hasValue) {
41
-		[tabBarController rnn_setTabBarBackgroundColor:options.bottomTabs.backgroundColor.get];
36
+	if (newOptions.bottomTabs.backgroundColor.hasValue) {
37
+		[tabBarController rnn_setTabBarBackgroundColor:newOptions.bottomTabs.backgroundColor.get];
42 38
 	}
43 39
 	
44
-	if (options.bottomTabs.barStyle.hasValue) {
45
-		[tabBarController rnn_setTabBarStyle:[RCTConvert UIBarStyle:options.bottomTabs.barStyle.get]];
40
+	if (newOptions.bottomTabs.barStyle.hasValue) {
41
+		[tabBarController rnn_setTabBarStyle:[RCTConvert UIBarStyle:newOptions.bottomTabs.barStyle.get]];
46 42
 	}
47 43
 	
48
-	if (options.bottomTabs.translucent.hasValue) {
49
-		[tabBarController rnn_setTabBarTranslucent:options.bottomTabs.translucent.get];
44
+	if (newOptions.bottomTabs.translucent.hasValue) {
45
+		[tabBarController rnn_setTabBarTranslucent:newOptions.bottomTabs.translucent.get];
50 46
 	}
51 47
 	
52
-	if (options.bottomTabs.hideShadow.hasValue) {
53
-		[tabBarController rnn_setTabBarHideShadow:options.bottomTabs.hideShadow.get];
48
+	if (newOptions.bottomTabs.hideShadow.hasValue) {
49
+		[tabBarController rnn_setTabBarHideShadow:newOptions.bottomTabs.hideShadow.get];
54 50
 	}
55 51
 	
56
-	if (options.bottomTabs.visible.hasValue) {
57
-		[tabBarController rnn_setTabBarVisible:options.bottomTabs.visible.get];
52
+	if (newOptions.bottomTabs.visible.hasValue) {
53
+		[tabBarController rnn_setTabBarVisible:newOptions.bottomTabs.visible.get];
58 54
 	}
59 55
 }
60 56
 

+ 1
- 0
lib/ios/RNNTopTabsViewController.h Datei anzeigen

@@ -8,6 +8,7 @@
8 8
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
9 9
 @property (nonatomic, retain) RNNViewControllerPresenter* presenter;
10 10
 @property (nonatomic, strong) RNNNavigationOptions* options;
11
+@property (nonatomic, strong) RNNNavigationOptions* defaultOptions;
11 12
 
12 13
 - (void)setViewControllers:(NSArray*)viewControllers;
13 14
 - (void)viewController:(UIViewController*)vc changedTitle:(NSString*)title;

+ 8
- 3
lib/ios/RNNTopTabsViewController.m Datei anzeigen

@@ -13,12 +13,13 @@
13 13
 
14 14
 @implementation RNNTopTabsViewController
15 15
 
16
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNViewControllerPresenter *)presenter {
16
+- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions presenter:(RNNViewControllerPresenter *)presenter {
17 17
 	self = [self init];
18 18
 	
19 19
 	self.presenter = presenter;
20 20
 	[self.presenter bindViewController:self];
21 21
 	
22
+	self.defaultOptions = defaultOptions;
22 23
 	self.options = options;
23 24
 	self.layoutInfo = layoutInfo;
24 25
 	
@@ -45,14 +46,18 @@
45 46
 }
46 47
 
47 48
 - (RNNNavigationOptions *)resolveOptions {
48
-	return (RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options];
49
+	return [(RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options] withDefault:self.defaultOptions];
49 50
 }
50 51
 
51 52
 - (void)mergeOptions:(RNNNavigationOptions *)options {
52
-	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
53
+	[_presenter mergeOptions:options currentOptions:self.options defaultOptions:self.defaultOptions];
53 54
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
54 55
 }
55 56
 
57
+- (void)overrideOptions:(RNNNavigationOptions *)options {
58
+	[self.options overrideOptions:options];
59
+}
60
+
56 61
 - (void)createTabBar {
57 62
 	_segmentedControl = [[RNNSegmentedControl alloc] initWithSectionTitles:@[@"", @"", @""]];
58 63
 	_segmentedControl.frame = CGRectMake(0, 0, self.view.bounds.size.width, 50);

+ 36
- 40
lib/ios/RNNViewControllerPresenter.m Datei anzeigen

@@ -12,9 +12,8 @@
12 12
 @implementation RNNViewControllerPresenter
13 13
 
14 14
 
15
-- (void)applyOptions:(RNNNavigationOptions *)initialOptions {
16
-	[super applyOptions:initialOptions];
17
-	RNNNavigationOptions* options = [initialOptions withDefault:self.defaultOptions];
15
+- (void)applyOptions:(RNNNavigationOptions *)options {
16
+	[super applyOptions:options];
18 17
 	
19 18
 	UIViewController* viewController = self.bindedViewController;
20 19
 	[viewController rnn_setBackgroundImage:[options.backgroundImage getWithDefaultValue:nil]];
@@ -38,7 +37,6 @@
38 37
 		_navigationButtons = [[RNNNavigationButtons alloc] initWithViewController:(RNNRootViewController*)viewController];
39 38
 		[_navigationButtons applyLeftButtons:options.topBar.leftButtons rightButtons:options.topBar.rightButtons defaultLeftButtonStyle:options.topBar.leftButtonStyle defaultRightButtonStyle:options.topBar.rightButtonStyle];
40 39
 	}
41
-	
42 40
 }
43 41
 
44 42
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)options {
@@ -51,78 +49,76 @@
51 49
 	[viewController rnn_setDrawBehindTabBar:[options.bottomTabs.drawBehind getWithDefaultValue:NO] || ![options.bottomTabs.visible getWithDefaultValue:YES]];
52 50
 }
53 51
 
54
-- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
55
-	[super mergeOptions:options resolvedOptions:resolvedOptions];
56
-	
57
-	RNNNavigationOptions* withDefault = (RNNNavigationOptions *)[options withDefault:self.defaultOptions];
52
+- (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions defaultOptions:(RNNNavigationOptions *)defaultOptions {
53
+	[super mergeOptions:newOptions currentOptions:currentOptions defaultOptions:defaultOptions];
58 54
 	
59 55
 	UIViewController* viewController = self.bindedViewController;
60 56
 	
61
-	if (options.backgroundImage.hasValue) {
62
-		[viewController rnn_setBackgroundImage:options.backgroundImage.get];
57
+	if (newOptions.backgroundImage.hasValue) {
58
+		[viewController rnn_setBackgroundImage:newOptions.backgroundImage.get];
63 59
 	}
64 60
 	
65
-	if (options.modalPresentationStyle.hasValue) {
66
-		[viewController rnn_setModalPresentationStyle:[RCTConvert UIModalPresentationStyle:options.modalPresentationStyle.get]];
61
+	if (newOptions.modalPresentationStyle.hasValue) {
62
+		[viewController rnn_setModalPresentationStyle:[RCTConvert UIModalPresentationStyle:newOptions.modalPresentationStyle.get]];
67 63
 	}
68 64
 	
69
-	if (options.modalTransitionStyle.hasValue) {
70
-		[viewController rnn_setModalTransitionStyle:[RCTConvert UIModalTransitionStyle:options.modalTransitionStyle.get]];
65
+	if (newOptions.modalTransitionStyle.hasValue) {
66
+		[viewController rnn_setModalTransitionStyle:[RCTConvert UIModalTransitionStyle:newOptions.modalTransitionStyle.get]];
71 67
 	}
72 68
 	
73
-	if (options.topBar.searchBar.hasValue) {
74
-		[viewController rnn_setSearchBarWithPlaceholder:[withDefault.topBar.searchBarPlaceholder getWithDefaultValue:@""]];
69
+	if (newOptions.topBar.searchBar.hasValue) {
70
+		[viewController rnn_setSearchBarWithPlaceholder:[newOptions.topBar.searchBarPlaceholder getWithDefaultValue:@""]];
75 71
 	}
76 72
 	
77
-	if (options.topBar.drawBehind.hasValue) {
78
-		[viewController rnn_setDrawBehindTopBar:options.topBar.drawBehind.get];
73
+	if (newOptions.topBar.drawBehind.hasValue) {
74
+		[viewController rnn_setDrawBehindTopBar:newOptions.topBar.drawBehind.get];
79 75
 	}
80 76
 	
81
-	if (options.topBar.title.text.hasValue) {
82
-		[viewController rnn_setNavigationItemTitle:options.topBar.title.text.get];
77
+	if (newOptions.topBar.title.text.hasValue) {
78
+		[viewController rnn_setNavigationItemTitle:newOptions.topBar.title.text.get];
83 79
 	}
84 80
 	
85
-	if (options.topBar.largeTitle.visible.hasValue) {
86
-		[viewController rnn_setTopBarPrefersLargeTitle:options.topBar.largeTitle.visible.get];
81
+	if (newOptions.topBar.largeTitle.visible.hasValue) {
82
+		[viewController rnn_setTopBarPrefersLargeTitle:newOptions.topBar.largeTitle.visible.get];
87 83
 	}
88 84
 	
89
-	if (options.bottomTabs.drawBehind.hasValue) {
90
-		[viewController rnn_setDrawBehindTabBar:options.bottomTabs.drawBehind.get];
85
+	if (newOptions.bottomTabs.drawBehind.hasValue) {
86
+		[viewController rnn_setDrawBehindTabBar:newOptions.bottomTabs.drawBehind.get];
91 87
 	}
92 88
 	
93
-	if (options.bottomTab.badgeColor.hasValue) {
94
-		[viewController rnn_setTabBarItemBadgeColor:options.bottomTab.badgeColor.get];
89
+	if (newOptions.bottomTab.badgeColor.hasValue) {
90
+		[viewController rnn_setTabBarItemBadgeColor:newOptions.bottomTab.badgeColor.get];
95 91
 	}
96 92
 	
97
-	if (options.layout.backgroundColor.hasValue) {
98
-		[viewController rnn_setBackgroundColor:options.layout.backgroundColor.get];
93
+	if (newOptions.layout.backgroundColor.hasValue) {
94
+		[viewController rnn_setBackgroundColor:newOptions.layout.backgroundColor.get];
99 95
 	}
100 96
 	
101
-	if (options.bottomTab.visible.hasValue) {
97
+	if (newOptions.bottomTab.visible.hasValue) {
102 98
 		[viewController.tabBarController rnn_setCurrentTabIndex:[viewController.tabBarController.viewControllers indexOfObject:viewController]];
103 99
 	}
104 100
 	
105
-	if (options.statusBar.blur.hasValue) {
106
-		[viewController rnn_setStatusBarBlur:options.statusBar.blur.get];
101
+	if (newOptions.statusBar.blur.hasValue) {
102
+		[viewController rnn_setStatusBarBlur:newOptions.statusBar.blur.get];
107 103
 	}
108 104
 	
109
-	if (options.statusBar.style.hasValue) {
110
-		[viewController rnn_setStatusBarStyle:options.statusBar.style.get animated:[withDefault.statusBar.animate getWithDefaultValue:YES]];
105
+	if (newOptions.statusBar.style.hasValue) {
106
+		[viewController rnn_setStatusBarStyle:newOptions.statusBar.style.get animated:[newOptions.statusBar.animate getWithDefaultValue:YES]];
111 107
 	}
112 108
 	
113
-	if (options.topBar.backButton.visible.hasValue) {
114
-		[viewController rnn_setBackButtonVisible:options.topBar.backButton.visible.get];
109
+	if (newOptions.topBar.backButton.visible.hasValue) {
110
+		[viewController rnn_setBackButtonVisible:newOptions.topBar.backButton.visible.get];
115 111
 	}
116 112
 	
117
-	if (options.topBar.leftButtons || options.topBar.rightButtons) {
118
-		RNNNavigationOptions* buttonsResolvedOptions = (RNNNavigationOptions *)[[resolvedOptions overrideOptions:options] withDefault:self.defaultOptions];
113
+	if (newOptions.topBar.leftButtons || newOptions.topBar.rightButtons) {
114
+		RNNNavigationOptions* buttonsResolvedOptions = [(RNNNavigationOptions *)[currentOptions overrideOptions:newOptions] withDefault:defaultOptions];
119 115
 		_navigationButtons = [[RNNNavigationButtons alloc] initWithViewController:(RNNRootViewController*)viewController];
120
-		[_navigationButtons applyLeftButtons:options.topBar.leftButtons rightButtons:options.topBar.rightButtons defaultLeftButtonStyle:buttonsResolvedOptions.topBar.leftButtonStyle defaultRightButtonStyle:buttonsResolvedOptions.topBar.rightButtonStyle];
116
+		[_navigationButtons applyLeftButtons:newOptions.topBar.leftButtons rightButtons:newOptions.topBar.rightButtons defaultLeftButtonStyle:buttonsResolvedOptions.topBar.leftButtonStyle defaultRightButtonStyle:buttonsResolvedOptions.topBar.rightButtonStyle];
121 117
 	}
122 118
 	
123
-	if (options.overlay.interceptTouchOutside.hasValue) {
119
+	if (newOptions.overlay.interceptTouchOutside.hasValue) {
124 120
 		RCTRootView* rootView = (RCTRootView*)viewController.view;
125
-		rootView.passThroughTouches = !options.overlay.interceptTouchOutside.get;
121
+		rootView.passThroughTouches = !newOptions.overlay.interceptTouchOutside.get;
126 122
 	}
127 123
 }
128 124
 

+ 4
- 12
lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj Datei anzeigen

@@ -72,8 +72,6 @@
72 72
 		5012240B21735959000F5F98 /* RNNSideMenuPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5012240921735959000F5F98 /* RNNSideMenuPresenter.m */; };
73 73
 		5012240E21735999000F5F98 /* RNNBasePresenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 5012240C21735999000F5F98 /* RNNBasePresenter.h */; };
74 74
 		5012240F21735999000F5F98 /* RNNBasePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5012240D21735999000F5F98 /* RNNBasePresenter.m */; };
75
-		5012241221735F89000F5F98 /* RNNBottomTabPresenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 5012241021735F89000F5F98 /* RNNBottomTabPresenter.h */; };
76
-		5012241321735F89000F5F98 /* RNNBottomTabPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5012241121735F89000F5F98 /* RNNBottomTabPresenter.m */; };
77 75
 		5012241621736667000F5F98 /* Color.h in Headers */ = {isa = PBXBuildFile; fileRef = 5012241421736667000F5F98 /* Color.h */; };
78 76
 		5012241721736667000F5F98 /* Color.m in Sources */ = {isa = PBXBuildFile; fileRef = 5012241521736667000F5F98 /* Color.m */; };
79 77
 		5012241A21736678000F5F98 /* Image.h in Headers */ = {isa = PBXBuildFile; fileRef = 5012241821736678000F5F98 /* Image.h */; };
@@ -100,7 +98,7 @@
100 98
 		502CB46E20CD1DDA0019B2FE /* RNNBackButtonOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 502CB46C20CD1DDA0019B2FE /* RNNBackButtonOptions.h */; };
101 99
 		502CB46F20CD1DDA0019B2FE /* RNNBackButtonOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 502CB46D20CD1DDA0019B2FE /* RNNBackButtonOptions.m */; };
102 100
 		502F0E142178CF8200367CC3 /* UIViewController+RNNOptionsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 502F0E132178CF8200367CC3 /* UIViewController+RNNOptionsTest.m */; };
103
-		502F0E162178D09600367CC3 /* RNNBottomTabPresenterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 502F0E152178D09600367CC3 /* RNNBottomTabPresenterTest.m */; };
101
+		502F0E162178D09600367CC3 /* RNNBasePresenterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 502F0E152178D09600367CC3 /* RNNBasePresenterTest.m */; };
104 102
 		502F0E182179C39900367CC3 /* RNNTabBarPresenterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 502F0E172179C39900367CC3 /* RNNTabBarPresenterTest.m */; };
105 103
 		5038A374216CDDB6009280BC /* UIViewController+SideMenuController.h in Headers */ = {isa = PBXBuildFile; fileRef = 5038A372216CDDB6009280BC /* UIViewController+SideMenuController.h */; };
106 104
 		5038A375216CDDB6009280BC /* UIViewController+SideMenuController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5038A373216CDDB6009280BC /* UIViewController+SideMenuController.m */; };
@@ -392,8 +390,6 @@
392 390
 		5012240921735959000F5F98 /* RNNSideMenuPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNSideMenuPresenter.m; sourceTree = "<group>"; };
393 391
 		5012240C21735999000F5F98 /* RNNBasePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNBasePresenter.h; sourceTree = "<group>"; };
394 392
 		5012240D21735999000F5F98 /* RNNBasePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNBasePresenter.m; sourceTree = "<group>"; };
395
-		5012241021735F89000F5F98 /* RNNBottomTabPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNBottomTabPresenter.h; sourceTree = "<group>"; };
396
-		5012241121735F89000F5F98 /* RNNBottomTabPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNBottomTabPresenter.m; sourceTree = "<group>"; };
397 393
 		5012241421736667000F5F98 /* Color.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Color.h; sourceTree = "<group>"; };
398 394
 		5012241521736667000F5F98 /* Color.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Color.m; sourceTree = "<group>"; };
399 395
 		5012241821736678000F5F98 /* Image.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = "<group>"; };
@@ -420,7 +416,7 @@
420 416
 		502CB46C20CD1DDA0019B2FE /* RNNBackButtonOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNBackButtonOptions.h; sourceTree = "<group>"; };
421 417
 		502CB46D20CD1DDA0019B2FE /* RNNBackButtonOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNBackButtonOptions.m; sourceTree = "<group>"; };
422 418
 		502F0E132178CF8200367CC3 /* UIViewController+RNNOptionsTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+RNNOptionsTest.m"; sourceTree = "<group>"; };
423
-		502F0E152178D09600367CC3 /* RNNBottomTabPresenterTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNBottomTabPresenterTest.m; sourceTree = "<group>"; };
419
+		502F0E152178D09600367CC3 /* RNNBasePresenterTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNBasePresenterTest.m; sourceTree = "<group>"; };
424 420
 		502F0E172179C39900367CC3 /* RNNTabBarPresenterTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNTabBarPresenterTest.m; sourceTree = "<group>"; };
425 421
 		5038A372216CDDB6009280BC /* UIViewController+SideMenuController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIViewController+SideMenuController.h"; sourceTree = "<group>"; };
426 422
 		5038A373216CDDB6009280BC /* UIViewController+SideMenuController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+SideMenuController.m"; sourceTree = "<group>"; };
@@ -922,8 +918,6 @@
922 918
 				501224052173592D000F5F98 /* RNNTabBarPresenter.m */,
923 919
 				5012240821735959000F5F98 /* RNNSideMenuPresenter.h */,
924 920
 				5012240921735959000F5F98 /* RNNSideMenuPresenter.m */,
925
-				5012241021735F89000F5F98 /* RNNBottomTabPresenter.h */,
926
-				5012241121735F89000F5F98 /* RNNBottomTabPresenter.m */,
927 921
 			);
928 922
 			name = Presenters;
929 923
 			sourceTree = "<group>";
@@ -1007,7 +1001,7 @@
1007 1001
 				509B258E2178BE7A00C83C23 /* RNNNavigationControllerPresenterTest.m */,
1008 1002
 				502F0E172179C39900367CC3 /* RNNTabBarPresenterTest.m */,
1009 1003
 				50CE8502217C6C9B00084EBF /* RNNSideMenuPresenterTest.m */,
1010
-				502F0E152178D09600367CC3 /* RNNBottomTabPresenterTest.m */,
1004
+				502F0E152178D09600367CC3 /* RNNBasePresenterTest.m */,
1011 1005
 				5038A378216D01F6009280BC /* RNNBottomTabOptionsTest.m */,
1012 1006
 				7B49FEBF1E95090800DEB3EA /* Info.plist */,
1013 1007
 				E83BAD671F2734B500A9F3DD /* RNNNavigationOptionsTest.m */,
@@ -1235,7 +1229,6 @@
1235 1229
 				50762D08205E96C200E3D18A /* RNNModalAnimation.h in Headers */,
1236 1230
 				390AD477200F499D00A8250D /* RNNSwizzles.h in Headers */,
1237 1231
 				263905B11E4C6F440023D7D3 /* MMDrawerController.h in Headers */,
1238
-				5012241221735F89000F5F98 /* RNNBottomTabPresenter.h in Headers */,
1239 1232
 				263905B91E4C6F440023D7D3 /* RCCDrawerController.h in Headers */,
1240 1233
 				263905B31E4C6F440023D7D3 /* MMDrawerVisualState.h in Headers */,
1241 1234
 				502CB43A20CBCA180019B2FE /* RNNBridgeManagerDelegate.h in Headers */,
@@ -1371,7 +1364,7 @@
1371 1364
 				502F0E142178CF8200367CC3 /* UIViewController+RNNOptionsTest.m in Sources */,
1372 1365
 				5038A377216CF252009280BC /* UITabBarController+RNNOptionsTest.m in Sources */,
1373 1366
 				E83BAD7C1F27643000A9F3DD /* RNNTestRootViewCreator.m in Sources */,
1374
-				502F0E162178D09600367CC3 /* RNNBottomTabPresenterTest.m in Sources */,
1367
+				502F0E162178D09600367CC3 /* RNNBasePresenterTest.m in Sources */,
1375 1368
 				504753782109C13C00FFFBE6 /* RNNOverlayManagerTest.m in Sources */,
1376 1369
 				502F0E182179C39900367CC3 /* RNNTabBarPresenterTest.m in Sources */,
1377 1370
 				506F630F216A5AD700AD0D0A /* RNNViewControllerPresenterTest.m in Sources */,
@@ -1397,7 +1390,6 @@
1397 1390
 			buildActionMask = 2147483647;
1398 1391
 			files = (
1399 1392
 				263905C71E4C6F440023D7D3 /* SidebarFeedlyAnimation.m in Sources */,
1400
-				5012241321735F89000F5F98 /* RNNBottomTabPresenter.m in Sources */,
1401 1393
 				50C4A497206BDDBB00DB292E /* RNNSubtitleOptions.m in Sources */,
1402 1394
 				263905B41E4C6F440023D7D3 /* MMDrawerVisualState.m in Sources */,
1403 1395
 				5012240B21735959000F5F98 /* RNNSideMenuPresenter.m in Sources */,

lib/ios/ReactNativeNavigationTests/RNNBottomTabPresenterTest.m → lib/ios/ReactNativeNavigationTests/RNNBasePresenterTest.m Datei anzeigen

@@ -1,11 +1,11 @@
1 1
 #import <XCTest/XCTest.h>
2
-#import "RNNBottomTabPresenter.h"
2
+#import "RNNBasePresenter.h"
3 3
 #import <OCMock/OCMock.h>
4 4
 #import "UIViewController+RNNOptions.h"
5 5
 
6 6
 @interface RNNBottomTabPresenterTest : XCTestCase
7 7
 
8
-@property (nonatomic, strong) RNNBottomTabPresenter *uut;
8
+@property (nonatomic, strong) RNNBasePresenter *uut;
9 9
 @property (nonatomic, strong) RNNNavigationOptions *options;
10 10
 @property (nonatomic, strong) UIViewController* bindedViewController;
11 11
 @property (nonatomic, strong) id mockBindedViewController;
@@ -16,7 +16,7 @@
16 16
 
17 17
 - (void)setUp {
18 18
     [super setUp];
19
-    self.uut = [[RNNBottomTabPresenter alloc] init];
19
+    self.uut = [[RNNBasePresenter alloc] init];
20 20
 	self.bindedViewController = [UIViewController new];
21 21
     self.mockBindedViewController = [OCMockObject partialMockForObject:self.bindedViewController];
22 22
     [self.uut bindViewController:self.mockBindedViewController];

+ 3
- 3
lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m Datei anzeigen

@@ -109,9 +109,9 @@
109 109
 	RNNTestRootViewCreator* creator = [[RNNTestRootViewCreator alloc] init];
110 110
 	
111 111
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
112
-	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:creator eventEmitter:nil presenter:presenter options:initialOptions];
112
+	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:creator eventEmitter:nil presenter:presenter options:initialOptions defaultOptions:nil];
113 113
 	
114
-	RNNNavigationController* nav = [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[vc] options:[[RNNNavigationOptions alloc] initEmptyOptions] presenter:[[RNNNavigationControllerPresenter alloc] init]];
114
+	RNNNavigationController* nav = [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[vc] options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:[[RNNNavigationControllerPresenter alloc] init]];
115 115
 	
116 116
 	[vc viewWillAppear:false];
117 117
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
@@ -133,7 +133,7 @@
133 133
 	initialOptions.topBar.title.text = [[Text alloc] initWithValue:@"the title"];
134 134
 	
135 135
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
136
-	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithLayoutInfo:nil rootViewCreator:[[RNNTestRootViewCreator alloc] init] eventEmitter:nil presenter:presenter options:initialOptions];
136
+	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithLayoutInfo:nil rootViewCreator:[[RNNTestRootViewCreator alloc] init] eventEmitter:nil presenter:presenter options:initialOptions defaultOptions:nil];
137 137
 	
138 138
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:vc];
139 139
 	[vc viewWillAppear:false];

+ 38
- 7
lib/ios/ReactNativeNavigationTests/RNNNavigationControllerTest.m Datei anzeigen

@@ -1,4 +1,5 @@
1 1
 #import <XCTest/XCTest.h>
2
+#import <OCMock/OCMock.h>
2 3
 #import "RNNNavigationController.h"
3 4
 #import "RNNRootViewController.h"
4 5
 
@@ -12,16 +13,17 @@
12 13
 	RNNRootViewController* _vc1;
13 14
 	RNNRootViewController* _vc2;
14 15
 	UIViewController* _vc3;
16
+	RNNNavigationOptions* _options;
15 17
 }
16 18
 
17 19
 - (void)setUp {
18 20
     [super setUp];
19 21
 	
20
-	_vc1 = [[RNNRootViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:[[RNNViewControllerPresenter alloc] init] options:[[RNNNavigationOptions alloc] initEmptyOptions]];
21
-	_vc2 = [[RNNRootViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:[[RNNViewControllerPresenter alloc] init] options:nil];
22
+	_vc1 = [[RNNRootViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:[[RNNViewControllerPresenter alloc] init] options:[[RNNNavigationOptions alloc] initEmptyOptions]  defaultOptions:[[RNNNavigationOptions alloc] initEmptyOptions]];
23
+	_vc2 = [[RNNRootViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:[[RNNViewControllerPresenter alloc] init] options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:[[RNNNavigationOptions alloc] initEmptyOptions]];
22 24
 	_vc3 = [UIViewController new];
23
-	
24
-	self.uut = [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[_vc1, _vc2] options:[[RNNNavigationOptions alloc] initWithDict:@{}] presenter:[[RNNViewControllerPresenter alloc] init]];
25
+	_options = [[RNNNavigationOptions alloc] initEmptyOptions];
26
+	self.uut = [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[_vc1, _vc2] options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:[[RNNViewControllerPresenter alloc] init]];
25 27
 }
26 28
 
27 29
 - (void)testInitWithLayoutInfo_shouldBindPresenter {
@@ -29,7 +31,7 @@
29 31
 }
30 32
 
31 33
 - (void)testInitWithLayoutInfo_shouldSetMultipleViewControllers {
32
-	self.uut = [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[_vc1, _vc2] options:[[RNNNavigationOptions alloc] initWithDict:@{}] presenter:[[RNNViewControllerPresenter alloc] init]];
34
+	self.uut = [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[_vc1, _vc2] options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:[[RNNViewControllerPresenter alloc] init]];
33 35
 	XCTAssertTrue(self.uut.viewControllers.count == 2);
34 36
 }
35 37
 
@@ -42,7 +44,7 @@
42 44
 }
43 45
 
44 46
 - (void)testPreferredStatusBarStyle_shouldReturnLeafPreferredStatusBarStyle {
45
-	self.uut.getCurrentChild.options.statusBar.style = [[Text alloc] initWithValue:@"light"];
47
+	self.uut.getCurrentChild.resolveOptions.statusBar.style = [[Text alloc] initWithValue:@"light"];
46 48
 	XCTAssertTrue(self.uut.preferredStatusBarStyle == self.uut.getCurrentChild.preferredStatusBarStyle);
47 49
 }
48 50
 
@@ -106,8 +108,37 @@
106 108
 	XCTAssertEqual(self.uut.supportedInterfaceOrientations, self.uut.getCurrentChild.supportedInterfaceOrientations);
107 109
 }
108 110
 
111
+- (void)testPopViewControllerReturnLastChildViewController {
112
+	RNNNavigationController* uut = [RNNNavigationController new];
113
+	[uut setViewControllers:@[_vc1, _vc2]];
114
+	XCTAssertEqual([uut popViewControllerAnimated:NO], _vc2);
115
+}
116
+
117
+- (void)testPopViewControllerSetTopBarBackgroundForPoppingViewController {
118
+	RNNNavigationController* uut = [RNNNavigationController new];
119
+	[uut setViewControllers:@[_vc1, _vc2]];
120
+	
121
+	_options.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];
122
+	[_vc1 overrideOptions:_options];
123
+	
124
+	[uut popViewControllerAnimated:NO];
125
+	XCTAssertEqual(_vc1.resolveOptions.topBar.background.color.get, uut.navigationBar.barTintColor);
126
+}
127
+
128
+- (void)testPopViewControllerSetDefaultTopBarBackgroundForPoppingViewController {
129
+	RNNNavigationController* uut = [RNNNavigationController new];
130
+	[uut setViewControllers:@[_vc1, _vc2]];
131
+
132
+	_options.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];
133
+	[_vc1 setDefaultOptions:_options];
134
+
135
+	[uut popViewControllerAnimated:NO];
136
+	XCTAssertEqual(_vc1.resolveOptions.topBar.background.color.get, uut.navigationBar.barTintColor);
137
+}
138
+
139
+
109 140
 - (RNNNavigationController *)createNavigationControllerWithOptions:(RNNNavigationOptions *)options {
110
-	return [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[_vc1] options:options presenter:[[RNNNavigationControllerPresenter alloc] init]];
141
+	return [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[_vc1] options:options defaultOptions:nil presenter:[[RNNNavigationControllerPresenter alloc] init]];
111 142
 }
112 143
 
113 144
 @end

+ 31
- 15
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m Datei anzeigen

@@ -1,4 +1,5 @@
1 1
 #import <XCTest/XCTest.h>
2
+#import <OCMock/OCMock.h>
2 3
 #import "RNNRootViewController.h"
3 4
 #import "RNNReactRootViewCreator.h"
4 5
 #import "RNNTestRootViewCreator.h"
@@ -48,8 +49,8 @@
48 49
 	layoutInfo.componentId = self.componentId;
49 50
 	layoutInfo.name = self.pageName;
50 51
 	
51
-	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
52
-	self.uut = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:self.creator eventEmitter:self.emitter presenter:presenter options:self.options];
52
+	id presenter = [OCMockObject partialMockForObject:[[RNNViewControllerPresenter alloc] init]];
53
+	self.uut = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:self.creator eventEmitter:self.emitter presenter:presenter options:self.options defaultOptions:nil];
53 54
 }
54 55
 
55 56
 -(void)testTopBarBackgroundColor_validColor{
@@ -195,11 +196,11 @@
195 196
 	XCTAssertFalse(transparentView);
196 197
 }
197 198
 
198
-//-(void)testTopBarLargeTitle_default {
199
-//	[self.uut viewWillAppear:false];
200
-//
201
-//	XCTAssertEqual(self.uut.navigationItem.largeTitleDisplayMode,  UINavigationItemLargeTitleDisplayModeNever);
202
-//}
199
+-(void)testTopBarLargeTitle_default {
200
+	[self.uut viewWillAppear:false];
201
+
202
+	XCTAssertEqual(self.uut.navigationItem.largeTitleDisplayMode,  UINavigationItemLargeTitleDisplayModeNever);
203
+}
203 204
 
204 205
 -(void)testTopBarLargeTitle_true {
205 206
 	self.options.topBar.largeTitle.visible = [[Bool alloc] initWithValue:@(1)];
@@ -538,19 +539,34 @@
538 539
 	XCTAssertNotNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
539 540
 }
540 541
 
541
-//-(void)testBackgroundImage {
542
-//	UIImage* backgroundImage = [[UIImage alloc] init];
543
-//	self.options.backgroundImage = backgroundImage;
544
-//	[self.uut viewWillAppear:false];
545
-//
546
-//	XCTAssertTrue([[(UIImageView*)self.uut.view.subviews[0] image] isEqual:backgroundImage]);
547
-//}
542
+-(void)testBackgroundImage {
543
+	Image* backgroundImage = [[Image alloc] initWithValue:[[UIImage alloc] init]];
544
+	self.options.backgroundImage = backgroundImage;
545
+	[self.uut viewWillAppear:false];
546
+
547
+	XCTAssertTrue([[(UIImageView*)self.uut.view.subviews[0] image] isEqual:backgroundImage.get]);
548
+}
549
+
550
+- (void)testMergeOptionsShouldCallPresenterMergeOptions {
551
+	RNNNavigationOptions* newOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
552
+	[[(id)self.uut.presenter expect] mergeOptions:newOptions currentOptions:self.uut.options defaultOptions:self.uut.defaultOptions];
553
+	[self.uut mergeOptions:newOptions];
554
+	[(id)self.uut.presenter verify];
555
+}
556
+
557
+- (void)testOverrideOptions {
558
+	RNNNavigationOptions* newOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
559
+	newOptions.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];
560
+	
561
+	[self.uut overrideOptions:newOptions];
562
+	XCTAssertEqual([UIColor redColor], self.uut.options.topBar.background.color.get);
563
+}
548 564
 
549 565
 #pragma mark BottomTabs
550 566
 
551 567
 
552 568
 - (RNNNavigationController *)createNavigationController {
553
-	RNNNavigationController* nav = [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[self.uut] options:[[RNNNavigationOptions alloc] initEmptyOptions] presenter:[[RNNNavigationControllerPresenter alloc] init]];
569
+	RNNNavigationController* nav = [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[self.uut] options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:[[RNNNavigationControllerPresenter alloc] init]];
554 570
 	
555 571
 	return nav;
556 572
 }

+ 9
- 9
lib/ios/ReactNativeNavigationTests/RNNTabBarControllerTest.m Datei anzeigen

@@ -26,7 +26,7 @@
26 26
 	self.mockTabBarPresenter = [OCMockObject partialMockForObject:[[RNNTabBarPresenter alloc] init]];
27 27
 	self.mockChildViewController = [OCMockObject partialMockForObject:[RNNRootViewController new]];
28 28
 	self.mockEventEmmiter = [OCMockObject partialMockForObject:[RNNEventEmitter new]];
29
-	self.mockUut = [OCMockObject partialMockForObject:[[RNNTabBarController alloc] initWithLayoutInfo:nil childViewControllers:@[[[UIViewController alloc] init]] options:[[RNNNavigationOptions alloc] initWithDict:@{}] presenter:self.mockTabBarPresenter eventEmitter:self.mockEventEmmiter]];
29
+	self.mockUut = [OCMockObject partialMockForObject:[[RNNTabBarController alloc] initWithLayoutInfo:nil childViewControllers:@[[[UIViewController alloc] init]] options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:self.mockTabBarPresenter eventEmitter:self.mockEventEmmiter]];
30 30
 	OCMStub([self.mockUut selectedViewController]).andReturn(self.mockChildViewController);
31 31
 }
32 32
 
@@ -38,7 +38,7 @@
38 38
 	UIViewController* vc1 = [[UIViewController alloc] init];
39 39
 	UIViewController* vc2 = [[UIViewController alloc] init];
40 40
 	
41
-	RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:nil childViewControllers:@[vc1, vc2] options:[[RNNNavigationOptions alloc] initWithDict:@{}] presenter:[[RNNViewControllerPresenter alloc] init]];
41
+	RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:nil childViewControllers:@[vc1, vc2] options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:[[RNNViewControllerPresenter alloc] init]];
42 42
 	XCTAssertTrue(uut.viewControllers.count == 2);
43 43
 }
44 44
 
@@ -48,7 +48,7 @@
48 48
 	RNNTabBarPresenter* presenter = [[RNNTabBarPresenter alloc] init];
49 49
 	NSArray* childViewControllers = @[[UIViewController new]];
50 50
 	
51
-	RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
51
+	RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options defaultOptions:nil presenter:presenter];
52 52
 	XCTAssertTrue(uut.layoutInfo == layoutInfo);
53 53
 	XCTAssertTrue(uut.options == options);
54 54
 	XCTAssertTrue(uut.presenter == presenter);
@@ -63,7 +63,7 @@
63 63
 
64 64
 	NSArray* childViewControllers = @[[UIViewController new]];
65 65
 	
66
-	RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter eventEmitter:eventEmmiter];
66
+	RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options defaultOptions:nil presenter:presenter eventEmitter:eventEmmiter];
67 67
 	XCTAssertTrue(uut.layoutInfo == layoutInfo);
68 68
 	XCTAssertTrue(uut.options == options);
69 69
 	XCTAssertTrue(uut.presenter == presenter);
@@ -72,13 +72,13 @@
72 72
 }
73 73
 
74 74
 - (void)testInitWithLayoutInfo_shouldSetDelegate {
75
-	RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:nil childViewControllers:nil options:[[RNNNavigationOptions alloc] initWithDict:@{}] presenter:[[RNNViewControllerPresenter alloc] init]];
75
+	RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:nil childViewControllers:nil options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:[[RNNViewControllerPresenter alloc] init]];
76 76
 	
77 77
 	XCTAssertTrue(uut.delegate == uut);
78 78
 }
79 79
 
80 80
 - (void)testWillMoveToParent_invokePresenterApplyOptionsOnWillMoveToParent {
81
-	[[self.mockTabBarPresenter expect] applyOptionsOnWillMoveToParentViewController:[(RNNTabBarController *)self.mockUut options]];
81
+	[[self.mockTabBarPresenter expect] applyOptionsOnWillMoveToParentViewController:[(RNNTabBarController *)self.mockUut resolveOptions]];
82 82
 	[self.mockUut willMoveToParentViewController:[UIViewController new]];
83 83
 	[self.mockTabBarPresenter verify];
84 84
 }
@@ -98,7 +98,7 @@
98 98
 - (void)testMergeOptions_shouldInvokePresenterMergeOptions {
99 99
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{}];
100 100
 	
101
-	[(RNNTabBarPresenter *)[self.mockTabBarPresenter expect] mergeOptions:options resolvedOptions:nil];
101
+	[(RNNTabBarPresenter *)[self.mockTabBarPresenter expect] mergeOptions:options currentOptions:[(RNNTabBarController *)self.mockUut options] defaultOptions:nil];
102 102
 	[(RNNTabBarController *)self.mockUut mergeOptions:options];
103 103
 	[self.mockTabBarPresenter verify];
104 104
 }
@@ -160,9 +160,9 @@
160 160
 	RNNLayoutInfo* layoutInfo = [RNNLayoutInfo new];
161 161
 	layoutInfo.componentId = @"componentId";
162 162
 	
163
-	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:nil eventEmitter:nil presenter:nil options:nil];
163
+	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:nil eventEmitter:nil presenter:nil options:nil defaultOptions:nil];
164 164
 	
165
-	RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:nil childViewControllers:@[[UIViewController new], vc] options:nil presenter:[RNNTabBarPresenter new]];
165
+	RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:nil childViewControllers:@[[UIViewController new], vc] options:nil defaultOptions:nil presenter:[RNNTabBarPresenter new]];
166 166
 	[uut setSelectedIndexByComponentID:@"componentId"];
167 167
 	XCTAssertTrue(uut.selectedIndex == 1);
168 168
 }