Browse Source

Detached defaultOptions from presenters (#4219)

Yogev Ben David 6 years ago
parent
commit
4f3cbf0ab3
No account linked to committer's email address
34 changed files with 389 additions and 384 deletions
  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 View File

4
 
4
 
5
 @property (nonatomic, weak) id bindedViewController;
5
 @property (nonatomic, weak) id bindedViewController;
6
 
6
 
7
-@property (nonatomic, retain) RNNNavigationOptions* defaultOptions;
8
-
9
 - (void)bindViewController:(UIViewController *)bindedViewController;
7
 - (void)bindViewController:(UIViewController *)bindedViewController;
10
 
8
 
11
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions;
9
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions;
12
 
10
 
13
-- (void)applyOptions:(RNNNavigationOptions *)initialOptions;
11
+- (void)applyOptions:(RNNNavigationOptions *)options;
14
 
12
 
15
 - (void)applyOptionsOnWillMoveToParentViewController:(RNNNavigationOptions *)options;
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
 @end
17
 @end

+ 21
- 23
lib/ios/RNNBasePresenter.m View File

1
 #import "RNNBasePresenter.h"
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
 @implementation RNNBasePresenter
5
 @implementation RNNBasePresenter
11
 
6
 
12
-- (instancetype)init {
13
-	self = [super init];
14
-	self.bottomTabPresenter = [[RNNBottomTabPresenter alloc] init];
15
-	return self;
16
-}
17
-
18
 - (void)bindViewController:(UIViewController *)bindedViewController {
7
 - (void)bindViewController:(UIViewController *)bindedViewController {
19
 	_bindedViewController = bindedViewController;
8
 	_bindedViewController = bindedViewController;
20
-	[self.bottomTabPresenter bindViewController:bindedViewController];
21
 }
9
 }
22
 
10
 
23
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
11
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
25
 }
13
 }
26
 
14
 
27
 - (void)applyOptionsOnWillMoveToParentViewController:(RNNNavigationOptions *)options {
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
 @end
42
 @end

+ 0
- 13
lib/ios/RNNBottomTabPresenter.h View File

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 View File

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 View File

75
 		[CATransaction begin];
75
 		[CATransaction begin];
76
 		[CATransaction setCompletionBlock:completion];
76
 		[CATransaction setCompletionBlock:completion];
77
 		
77
 		
78
-		[vc.options overrideOptions:newOptions];
78
+		[vc overrideOptions:newOptions];
79
 		[vc mergeOptions:newOptions];
79
 		[vc mergeOptions:newOptions];
80
 
80
 
81
 		[CATransaction commit];
81
 		[CATransaction commit];
99
 	UIViewController<RNNLayoutProtocol> *newVc = [_controllerFactory createLayout:layout saveToStore:_store];
99
 	UIViewController<RNNLayoutProtocol> *newVc = [_controllerFactory createLayout:layout saveToStore:_store];
100
 	UIViewController *fromVC = [_store findComponentForId:componentId];
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
 		UIViewController* vc = [_store findComponentForId:componentId];
103
 		UIViewController* vc = [_store findComponentForId:componentId];
104
 		
104
 		
105
 		if([vc isKindOfClass:[RNNRootViewController class]]) {
105
 		if([vc isKindOfClass:[RNNRootViewController class]]) {
109
       		rootVc.previewCallback = ^(UIViewController *vcc) {
109
       		rootVc.previewCallback = ^(UIViewController *vcc) {
110
 				RNNRootViewController* rvc  = (RNNRootViewController*)vcc;
110
 				RNNRootViewController* rvc  = (RNNRootViewController*)vcc;
111
 				[self->_eventEmitter sendOnPreviewCompleted:componentId previewComponentId:newVc.layoutInfo.componentId];
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
 					[CATransaction begin];
113
 					[CATransaction begin];
114
 					[CATransaction setCompletionBlock:^{
114
 					[CATransaction setCompletionBlock:^{
115
 						[self->_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
115
 						[self->_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
122
 			
122
 			
123
 			CGSize size = CGSizeMake(rootVc.view.frame.size.width, rootVc.view.frame.size.height);
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
 				newVc.preferredContentSize = size;
134
 				newVc.preferredContentSize = size;
135
 			}
135
 			}
136
       
136
       
137
 			RCTExecuteOnMainQueue(^{
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
 				[rootVc registerForPreviewingWithDelegate:(id)rootVc sourceView:view];
139
 				[rootVc registerForPreviewingWithDelegate:(id)rootVc sourceView:view];
140
 			});
140
 			});
141
 		}
141
 		}
142
 	} else {
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
 				[_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
146
 				[_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
147
 				completion();
147
 				completion();
148
 			} rejection:rejection];
148
 			} rejection:rejection];
154
 	[self assertReady];
154
 	[self assertReady];
155
 	
155
 	
156
 	UIViewController<RNNParentProtocol> *newVC = [_controllerFactory createLayout:layout saveToStore:_store];
156
 	UIViewController<RNNParentProtocol> *newVC = [_controllerFactory createLayout:layout saveToStore:_store];
157
-	RNNNavigationOptions* options = [newVC getCurrentChild].options;
157
+	RNNNavigationOptions* options = [newVC getCurrentChild].resolveOptions;
158
 	UIViewController *fromVC = [_store findComponentForId:componentId];
158
 	UIViewController *fromVC = [_store findComponentForId:componentId];
159
 	__weak typeof(RNNEventEmitter*) weakEventEmitter = _eventEmitter;
159
 	__weak typeof(RNNEventEmitter*) weakEventEmitter = _eventEmitter;
160
 	[_stackManager setStackRoot:newVC fromViewController:fromVC animated:options.animations.setStackRoot.enable completion:^{
160
 	[_stackManager setStackRoot:newVC fromViewController:fromVC animated:options.animations.setStackRoot.enable completion:^{
168
 	
168
 	
169
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
169
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
170
 	RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
170
 	RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
171
-	[vc.options overrideOptions:options];
171
+	[vc overrideOptions:options];
172
 	
172
 	
173
 	UINavigationController *nvc = vc.navigationController;
173
 	UINavigationController *nvc = vc.navigationController;
174
 	
174
 	
175
 	if ([nvc topViewController] == vc) {
175
 	if ([nvc topViewController] == vc) {
176
-		if (vc.options.animations.pop) {
176
+		if (vc.resolveOptions.animations.pop) {
177
 			nvc.delegate = vc;
177
 			nvc.delegate = vc;
178
 		} else {
178
 		} else {
179
 			nvc.delegate = nil;
179
 			nvc.delegate = nil;
181
 	} else {
181
 	} else {
182
 		NSMutableArray * vcs = nvc.viewControllers.mutableCopy;
182
 		NSMutableArray * vcs = nvc.viewControllers.mutableCopy;
183
 		[vcs removeObject:vc];
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
 		[_store removeComponent:componentId];
188
 		[_store removeComponent:componentId];
189
 		[_eventEmitter sendOnNavigationCommandCompletion:pop params:@{@"componentId": componentId}];
189
 		[_eventEmitter sendOnNavigationCommandCompletion:pop params:@{@"componentId": componentId}];
190
 		completion();
190
 		completion();
195
 	[self assertReady];
195
 	[self assertReady];
196
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
196
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
197
 	RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
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
 		[_eventEmitter sendOnNavigationCommandCompletion:popTo params:@{@"componentId": componentId}];
201
 		[_eventEmitter sendOnNavigationCommandCompletion:popTo params:@{@"componentId": componentId}];
202
 		[self removePopedViewControllers:poppedViewControllers];
202
 		[self removePopedViewControllers:poppedViewControllers];
203
 		completion();
203
 		completion();
208
 	[self assertReady];
208
 	[self assertReady];
209
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
209
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
210
 	RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
210
 	RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
211
-	[vc.options overrideOptions:options];
211
+	[vc overrideOptions:options];
212
 	
212
 	
213
 	[CATransaction begin];
213
 	[CATransaction begin];
214
 	[CATransaction setCompletionBlock:^{
214
 	[CATransaction setCompletionBlock:^{
216
 		completion();
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
 		[self removePopedViewControllers:poppedViewControllers];
220
 		[self removePopedViewControllers:poppedViewControllers];
221
 	} rejection:^(NSString *code, NSString *message, NSError *error) {
221
 	} rejection:^(NSString *code, NSString *message, NSError *error) {
222
 		
222
 		
230
 	
230
 	
231
 	UIViewController<RNNParentProtocol> *newVc = [_controllerFactory createLayout:layout saveToStore:_store];
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
 			[_eventEmitter sendOnNavigationCommandCompletion:showModal params:@{@"layout": layout}];
235
 			[_eventEmitter sendOnNavigationCommandCompletion:showModal params:@{@"layout": layout}];
236
 			completion(componentId);
236
 			completion(componentId);
237
 		}];
237
 		}];
249
 	}
249
 	}
250
 	
250
 	
251
 	RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
251
 	RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
252
-	[modalToDismiss.getCurrentChild.options overrideOptions:options];
252
+	[modalToDismiss.getCurrentChild overrideOptions:options];
253
 	
253
 	
254
 	[self removePopedViewControllers:modalToDismiss.navigationController.viewControllers];
254
 	[self removePopedViewControllers:modalToDismiss.navigationController.viewControllers];
255
 	
255
 	

+ 9
- 15
lib/ios/RNNControllerFactory.m View File

105
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
105
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
106
 	
106
 	
107
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
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
 	if (!component.isExternalViewController) {
112
 	if (!component.isExternalViewController) {
113
 		CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
113
 		CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
121
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
121
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
122
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
122
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
123
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
123
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
124
-	[presenter setDefaultOptions:_defaultOptions];
125
 	
124
 	
126
 	UIViewController* externalVC = [_store getExternalComponent:layoutInfo bridge:_bridge];
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
 	[component bindViewController:externalVC];
128
 	[component bindViewController:externalVC];
130
 	
129
 	
131
 	return (UIViewController<RNNParentProtocol> *)component;
130
 	return (UIViewController<RNNParentProtocol> *)component;
134
 
133
 
135
 - (UIViewController<RNNParentProtocol> *)createStack:(RNNLayoutNode*)node {
134
 - (UIViewController<RNNParentProtocol> *)createStack:(RNNLayoutNode*)node {
136
 	RNNNavigationControllerPresenter* presenter = [[RNNNavigationControllerPresenter alloc] init];
135
 	RNNNavigationControllerPresenter* presenter = [[RNNNavigationControllerPresenter alloc] init];
137
-	[presenter setDefaultOptions:_defaultOptions];
138
 	
136
 	
139
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
137
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
140
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
138
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
141
 	
139
 	
142
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
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
 	return stack;
144
 	return stack;
147
 }
145
 }
150
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
148
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
151
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
149
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
152
 	RNNTabBarPresenter* presenter = [[RNNTabBarPresenter alloc] init];
150
 	RNNTabBarPresenter* presenter = [[RNNTabBarPresenter alloc] init];
153
-	[presenter setDefaultOptions:_defaultOptions];
154
 
151
 
155
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
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
 	return tabsController;
156
 	return tabsController;
160
 }
157
 }
163
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
160
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
164
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
161
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
165
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
162
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
166
-	[presenter setDefaultOptions:_defaultOptions];
167
 
163
 
168
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
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
 	return topTabsController;
168
 	return topTabsController;
173
 }
169
 }
176
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
172
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
177
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
173
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
178
 	RNNSideMenuPresenter* presenter = [[RNNSideMenuPresenter alloc] init];
174
 	RNNSideMenuPresenter* presenter = [[RNNSideMenuPresenter alloc] init];
179
-	[presenter setDefaultOptions:_defaultOptions];
180
 
175
 
181
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
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
 	return sideMenu;
180
 	return sideMenu;
186
 }
181
 }
191
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
186
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
192
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
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
 	return sideMenuChild;
191
 	return sideMenuChild;
197
 }
192
 }
200
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
195
 	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
201
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
196
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];;
202
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
197
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
203
-	[presenter setDefaultOptions:_defaultOptions];
204
 
198
 
205
 	NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
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
 	return splitViewController;
203
 	return splitViewController;
210
 }
204
 }

+ 2
- 2
lib/ios/RNNDefaultOptionsHelper.m View File

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

+ 5
- 0
lib/ios/RNNLayoutProtocol.h View File

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

+ 2
- 2
lib/ios/RNNModalManager.m View File

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

+ 1
- 0
lib/ios/RNNNavigationController.h View File

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

+ 13
- 7
lib/ios/RNNNavigationController.m View File

13
 
13
 
14
 @implementation RNNNavigationController
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
 	self = [super init];
17
 	self = [super init];
18
 
18
 
19
 	self.presenter = presenter;
19
 	self.presenter = presenter;
20
 	[self.presenter bindViewController:self];
20
 	[self.presenter bindViewController:self];
21
+	
22
+	self.defaultOptions = defaultOptions;
21
 	self.options = options;
23
 	self.options = options;
22
 	
24
 	
23
 	self.layoutInfo = layoutInfo;
25
 	self.layoutInfo = layoutInfo;
29
 
31
 
30
 - (void)willMoveToParentViewController:(UIViewController *)parent {
32
 - (void)willMoveToParentViewController:(UIViewController *)parent {
31
 	if (parent) {
33
 	if (parent) {
32
-		[_presenter applyOptionsOnWillMoveToParentViewController:self.options];
34
+		[_presenter applyOptionsOnWillMoveToParentViewController:self.resolveOptions];
33
 	}
35
 	}
34
 }
36
 }
35
 
37
 
39
 }
41
 }
40
 
42
 
41
 - (RNNNavigationOptions *)resolveOptions {
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
 - (void)mergeOptions:(RNNNavigationOptions *)options {
47
 - (void)mergeOptions:(RNNNavigationOptions *)options {
46
-	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
48
+	[_presenter mergeOptions:options currentOptions:self.options defaultOptions:self.defaultOptions];
47
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
49
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
48
 }
50
 }
49
 
51
 
52
+- (void)overrideOptions:(RNNNavigationOptions *)options {
53
+	[self.options overrideOptions:options];
54
+}
55
+
50
 - (UITabBarItem *)tabBarItem {
56
 - (UITabBarItem *)tabBarItem {
51
 	return self.viewControllers.firstObject.tabBarItem;
57
 	return self.viewControllers.firstObject.tabBarItem;
52
 }
58
 }
72
 		UIViewController *controller = self.viewControllers[self.viewControllers.count - 2];
78
 		UIViewController *controller = self.viewControllers[self.viewControllers.count - 2];
73
 		if ([controller isKindOfClass:[RNNRootViewController class]]) {
79
 		if ([controller isKindOfClass:[RNNRootViewController class]]) {
74
 			RNNRootViewController *rnnController = (RNNRootViewController *)controller;
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
 }
86
 }
81
 
87
 
82
 - (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
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
 - (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
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
 - (UIViewController *)getCurrentChild {
96
 - (UIViewController *)getCurrentChild {

+ 34
- 37
lib/ios/RNNNavigationControllerPresenter.m View File

5
 
5
 
6
 @implementation RNNNavigationControllerPresenter
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
 	RNNNavigationController* navigationController = self.bindedViewController;
11
 	RNNNavigationController* navigationController = self.bindedViewController;
14
 	
12
 	
37
 	[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] : @""];
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
 	RNNNavigationController* navigationController = self.bindedViewController;
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 View File

5
 
5
 
6
 @required
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
 - (void)onChildWillAppear;
10
 - (void)onChildWillAppear;
11
 
11
 

+ 7
- 3
lib/ios/RNNRootViewController.h View File

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

+ 39
- 37
lib/ios/RNNRootViewController.m View File

22
 
22
 
23
 @synthesize previewCallback;
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
 	self = [super init];
26
 	self = [super init];
27
 	
27
 	
28
 	self.layoutInfo = layoutInfo;
28
 	self.layoutInfo = layoutInfo;
39
 	self.presenter = presenter;
39
 	self.presenter = presenter;
40
 	[self.presenter bindViewController:self];
40
 	[self.presenter bindViewController:self];
41
 	self.options = options;
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
 	[[NSNotificationCenter defaultCenter] addObserver:self
48
 	[[NSNotificationCenter defaultCenter] addObserver:self
47
 											 selector:@selector(onJsReload)
49
 											 selector:@selector(onJsReload)
52
 	return self;
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
 	return self;
59
 	return self;
58
 }
60
 }
59
 
61
 
65
 
67
 
66
 - (void)willMoveToParentViewController:(UIViewController *)parent {
68
 - (void)willMoveToParentViewController:(UIViewController *)parent {
67
 	if (parent) {
69
 	if (parent) {
68
-		[_presenter applyOptionsOnWillMoveToParentViewController:self.options];
70
+		[_presenter applyOptionsOnWillMoveToParentViewController:self.resolveOptions];
69
 	}
71
 	}
70
 }
72
 }
71
 
73
 
72
 - (void)mergeOptions:(RNNNavigationOptions *)options {
74
 - (void)mergeOptions:(RNNNavigationOptions *)options {
73
-	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
75
+	[_presenter mergeOptions:options currentOptions:self.options defaultOptions:self.defaultOptions];
74
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
76
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
75
 	
77
 	
76
 	[self initCustomViews];
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
 	[super viewWillAppear:animated];
86
 	[super viewWillAppear:animated];
81
 	_isBeingPresented = YES;
87
 	_isBeingPresented = YES;
82
 	
88
 	
83
-	[_presenter applyOptions:self.options];
89
+	[_presenter applyOptions:self.resolveOptions];
84
 	[((UIViewController<RNNParentProtocol> *)self.parentViewController) onChildWillAppear];
90
 	[((UIViewController<RNNParentProtocol> *)self.parentViewController) onChildWillAppear];
85
 	
91
 	
86
 	[self initCustomViews];
92
 	[self initCustomViews];
87
 }
93
 }
88
 
94
 
89
 - (RNNNavigationOptions *)resolveOptions {
95
 - (RNNNavigationOptions *)resolveOptions {
90
-	return self.options;
96
+	return [self.options withDefault:self.defaultOptions];
91
 }
97
 }
92
 
98
 
93
 -(void)viewDidAppear:(BOOL)animated {
99
 -(void)viewDidAppear:(BOOL)animated {
156
 }
162
 }
157
 
163
 
158
 - (void)setTitleViewWithSubtitle {
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
 		[titleViewHelper setup];
167
 		[titleViewHelper setup];
162
 	}
168
 	}
163
 }
169
 }
164
 
170
 
165
 - (void)setCustomNavigationTitleView {
171
 - (void)setCustomNavigationTitleView {
166
 	if (!_customTitleView && _isBeingPresented) {
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
 			_customTitleView.backgroundColor = UIColor.clearColor;
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
 			[_customTitleView setAlignment:alignment];
177
 			[_customTitleView setAlignment:alignment];
172
 			BOOL isCenter = [alignment isEqualToString:@"center"];
178
 			BOOL isCenter = [alignment isEqualToString:@"center"];
173
 			__weak RNNReactView *weakTitleView = _customTitleView;
179
 			__weak RNNReactView *weakTitleView = _customTitleView;
193
 
199
 
194
 - (void)setCustomNavigationBarView {
200
 - (void)setCustomNavigationBarView {
195
 	if (!_customTopBar) {
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
 			_customTopBar = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
205
 			_customTopBar = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
200
 			reactView.backgroundColor = UIColor.clearColor;
206
 			reactView.backgroundColor = UIColor.clearColor;
213
 
219
 
214
 - (void)setCustomNavigationComponentBackground {
220
 - (void)setCustomNavigationComponentBackground {
215
 	if (!_customTopBarBackground) {
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
 			_customTopBarBackground = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
225
 			_customTopBarBackground = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
220
 			[self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
226
 			[self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
230
 	}
236
 	}
231
 }
237
 }
232
 
238
 
233
-- (RNNNavigationOptions *)optionsWithDefault {
234
-	return (RNNNavigationOptions *)[[self.options copy] withDefault:_presenter.defaultOptions];
235
-}
236
-
237
 -(BOOL)isCustomTransitioned {
239
 -(BOOL)isCustomTransitioned {
238
-	return self.optionsWithDefault.customTransition.animations != nil;
240
+	return self.resolveOptions.customTransition.animations != nil;
239
 }
241
 }
240
 
242
 
241
 - (BOOL)isExternalViewController {
243
 - (BOOL)isExternalViewController {
243
 }
245
 }
244
 
246
 
245
 - (BOOL)prefersStatusBarHidden {
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
 		return self.navigationController.isNavigationBarHidden;
251
 		return self.navigationController.isNavigationBarHidden;
250
 	}
252
 	}
251
 	
253
 	
253
 }
255
 }
254
 
256
 
255
 - (UIStatusBarStyle)preferredStatusBarStyle {
257
 - (UIStatusBarStyle)preferredStatusBarStyle {
256
-	if ([[self.optionsWithDefault.statusBar.style getWithDefaultValue:@"default"] isEqualToString:@"light"]) {
258
+	if ([[self.resolveOptions.statusBar.style getWithDefaultValue:@"default"] isEqualToString:@"light"]) {
257
 		return UIStatusBarStyleLightContent;
259
 		return UIStatusBarStyleLightContent;
258
 	} else {
260
 	} else {
259
 		return UIStatusBarStyleDefault;
261
 		return UIStatusBarStyleDefault;
261
 }
263
 }
262
 
264
 
263
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
265
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
264
-	return self.optionsWithDefault.layout.supportedOrientations;
266
+	return self.resolveOptions.layout.supportedOrientations;
265
 }
267
 }
266
 
268
 
267
 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
269
 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
268
 	RNNRootViewController* vc =  (RNNRootViewController*)viewController;
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
 		navigationController.delegate = nil;
272
 		navigationController.delegate = nil;
271
 	}
273
 	}
272
 }
274
 }
277
 												 toViewController:(UIViewController*)toVC {
279
 												 toViewController:(UIViewController*)toVC {
278
 	if (self.animator) {
280
 	if (self.animator) {
279
 		return self.animator;
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
 	} else {
286
 	} else {
285
 		return nil;
287
 		return nil;
286
 	}
288
 	}
289
 }
291
 }
290
 
292
 
291
 - (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
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
 - (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
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
 - (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location{
301
 - (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location{
328
 
330
 
329
 - (NSArray<id<UIPreviewActionItem>> *)previewActionItems {
331
 - (NSArray<id<UIPreviewActionItem>> *)previewActionItems {
330
 	NSMutableArray *actions = [[NSMutableArray alloc] init];
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
 		UIPreviewAction *action = [self convertAction:previewAction];
334
 		UIPreviewAction *action = [self convertAction:previewAction];
333
 		NSDictionary *actionActions = previewAction[@"actions"];
335
 		NSDictionary *actionActions = previewAction[@"actions"];
334
 		if (actionActions.count > 0) {
336
 		if (actionActions.count > 0) {

+ 2
- 1
lib/ios/RNNSideMenuChildVC.h View File

16
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
16
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
17
 @property (nonatomic, retain) RNNViewControllerPresenter* presenter;
17
 @property (nonatomic, retain) RNNViewControllerPresenter* presenter;
18
 @property (nonatomic, strong) RNNNavigationOptions* options;
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
 @end
23
 @end

+ 10
- 6
lib/ios/RNNSideMenuChildVC.m View File

9
 
9
 
10
 @implementation RNNSideMenuChildVC
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
 	self.type = type;
15
 	self.type = type;
16
 
16
 
17
 	return self;
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
 	self = [super init];
21
 	self = [super init];
22
 	
22
 	
23
 	self.child = childViewControllers[0];
23
 	self.child = childViewControllers[0];
25
 	self.presenter = presenter;
25
 	self.presenter = presenter;
26
 	[self.presenter bindViewController:self];
26
 	[self.presenter bindViewController:self];
27
 	
27
 	
28
-	
28
+	self.defaultOptions = defaultOptions;
29
 	self.options = options;
29
 	self.options = options;
30
 	self.layoutInfo = layoutInfo;
30
 	self.layoutInfo = layoutInfo;
31
 	
31
 	
40
 }
40
 }
41
 
41
 
42
 - (RNNNavigationOptions *)resolveOptions {
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
 - (void)mergeOptions:(RNNNavigationOptions *)options {
46
 - (void)mergeOptions:(RNNNavigationOptions *)options {
47
-	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
47
+	[_presenter mergeOptions:options currentOptions:self.options defaultOptions:self.defaultOptions];
48
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
48
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
49
 }
49
 }
50
 
50
 
51
+- (void)overrideOptions:(RNNNavigationOptions *)options {
52
+	[self.options overrideOptions:options];
53
+}
54
+
51
 - (UITabBarItem *)tabBarItem {
55
 - (UITabBarItem *)tabBarItem {
52
 	return self.child.tabBarItem;
56
 	return self.child.tabBarItem;
53
 }
57
 }

+ 1
- 0
lib/ios/RNNSideMenuController.h View File

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

+ 9
- 4
lib/ios/RNNSideMenuController.m View File

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

+ 31
- 33
lib/ios/RNNSideMenuPresenter.m View File

3
 
3
 
4
 @implementation RNNSideMenuPresenter
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
 	RNNSideMenuController* sideMenuController = self.bindedViewController;
9
 	RNNSideMenuController* sideMenuController = self.bindedViewController;
12
 	
10
 	
13
 	[sideMenuController side:MMDrawerSideLeft enabled:[options.sideMenu.left.enabled getWithDefaultValue:YES]];
11
 	[sideMenuController side:MMDrawerSideLeft enabled:[options.sideMenu.left.enabled getWithDefaultValue:YES]];
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
 	RNNSideMenuController* sideMenuController = self.bindedViewController;
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 View File

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

+ 8
- 3
lib/ios/RNNSplitViewController.m View File

2
 
2
 
3
 @implementation RNNSplitViewController
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
 	self = [super init];
6
 	self = [super init];
7
 	
7
 	
8
 	self.presenter = presenter;
8
 	self.presenter = presenter;
9
 	[self.presenter bindViewController:self];
9
 	[self.presenter bindViewController:self];
10
 	
10
 	
11
+	self.defaultOptions = defaultOptions;
11
 	self.options = options;
12
 	self.options = options;
12
 	self.layoutInfo = layoutInfo;
13
 	self.layoutInfo = layoutInfo;
13
 	
14
 	
24
 }
25
 }
25
 
26
 
26
 - (RNNNavigationOptions *)resolveOptions {
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
 - (void)mergeOptions:(RNNNavigationOptions *)options {
31
 - (void)mergeOptions:(RNNNavigationOptions *)options {
31
-	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
32
+	[_presenter mergeOptions:options currentOptions:self.options defaultOptions:self.defaultOptions];
32
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
33
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
33
 }
34
 }
34
 
35
 
36
+- (void)overrideOptions:(RNNNavigationOptions *)options {
37
+	[self.options overrideOptions:options];
38
+}
39
+
35
 - (void)bindChildViewControllers:(NSArray<UIViewController<RNNLayoutProtocol> *> *)viewControllers {
40
 - (void)bindChildViewControllers:(NSArray<UIViewController<RNNLayoutProtocol> *> *)viewControllers {
36
 	[self setViewControllers:viewControllers];
41
 	[self setViewControllers:viewControllers];
37
 	UIViewController<UISplitViewControllerDelegate>* masterViewController = viewControllers[0];
42
 	UIViewController<UISplitViewControllerDelegate>* masterViewController = viewControllers[0];

+ 2
- 1
lib/ios/RNNTabBarController.h View File

5
 
5
 
6
 @interface RNNTabBarController : UITabBarController <RNNParentProtocol, UITabBarControllerDelegate>
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
 - (void)setSelectedIndexByComponentID:(NSString *)componentID;
10
 - (void)setSelectedIndexByComponentID:(NSString *)componentID;
11
 
11
 
12
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
12
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
13
 @property (nonatomic, retain) RNNTabBarPresenter* presenter;
13
 @property (nonatomic, retain) RNNTabBarPresenter* presenter;
14
 @property (nonatomic, strong) RNNNavigationOptions* options;
14
 @property (nonatomic, strong) RNNNavigationOptions* options;
15
+@property (nonatomic, strong) RNNNavigationOptions* defaultOptions;
15
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
16
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
16
 
17
 
17
 @end
18
 @end

+ 11
- 4
lib/ios/RNNTabBarController.m View File

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

+ 21
- 25
lib/ios/RNNTabBarPresenter.m View File

3
 
3
 
4
 @implementation RNNTabBarPresenter
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
 	UITabBarController* tabBarController = self.bindedViewController;
7
 	UITabBarController* tabBarController = self.bindedViewController;
12
 	
8
 	
13
 	[tabBarController rnn_setTabBarTestID:[options.bottomTabs.testID getWithDefaultValue:nil]];
9
 	[tabBarController rnn_setTabBarTestID:[options.bottomTabs.testID getWithDefaultValue:nil]];
18
 	[tabBarController rnn_setTabBarVisible:[options.bottomTabs.visible getWithDefaultValue:YES]];
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
 	UITabBarController* tabBarController = self.bindedViewController;
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 View File

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

+ 8
- 3
lib/ios/RNNTopTabsViewController.m View File

13
 
13
 
14
 @implementation RNNTopTabsViewController
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
 	self = [self init];
17
 	self = [self init];
18
 	
18
 	
19
 	self.presenter = presenter;
19
 	self.presenter = presenter;
20
 	[self.presenter bindViewController:self];
20
 	[self.presenter bindViewController:self];
21
 	
21
 	
22
+	self.defaultOptions = defaultOptions;
22
 	self.options = options;
23
 	self.options = options;
23
 	self.layoutInfo = layoutInfo;
24
 	self.layoutInfo = layoutInfo;
24
 	
25
 	
45
 }
46
 }
46
 
47
 
47
 - (RNNNavigationOptions *)resolveOptions {
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
 - (void)mergeOptions:(RNNNavigationOptions *)options {
52
 - (void)mergeOptions:(RNNNavigationOptions *)options {
52
-	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
53
+	[_presenter mergeOptions:options currentOptions:self.options defaultOptions:self.defaultOptions];
53
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
54
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
54
 }
55
 }
55
 
56
 
57
+- (void)overrideOptions:(RNNNavigationOptions *)options {
58
+	[self.options overrideOptions:options];
59
+}
60
+
56
 - (void)createTabBar {
61
 - (void)createTabBar {
57
 	_segmentedControl = [[RNNSegmentedControl alloc] initWithSectionTitles:@[@"", @"", @""]];
62
 	_segmentedControl = [[RNNSegmentedControl alloc] initWithSectionTitles:@[@"", @"", @""]];
58
 	_segmentedControl.frame = CGRectMake(0, 0, self.view.bounds.size.width, 50);
63
 	_segmentedControl.frame = CGRectMake(0, 0, self.view.bounds.size.width, 50);

+ 36
- 40
lib/ios/RNNViewControllerPresenter.m View File

12
 @implementation RNNViewControllerPresenter
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
 	UIViewController* viewController = self.bindedViewController;
18
 	UIViewController* viewController = self.bindedViewController;
20
 	[viewController rnn_setBackgroundImage:[options.backgroundImage getWithDefaultValue:nil]];
19
 	[viewController rnn_setBackgroundImage:[options.backgroundImage getWithDefaultValue:nil]];
38
 		_navigationButtons = [[RNNNavigationButtons alloc] initWithViewController:(RNNRootViewController*)viewController];
37
 		_navigationButtons = [[RNNNavigationButtons alloc] initWithViewController:(RNNRootViewController*)viewController];
39
 		[_navigationButtons applyLeftButtons:options.topBar.leftButtons rightButtons:options.topBar.rightButtons defaultLeftButtonStyle:options.topBar.leftButtonStyle defaultRightButtonStyle:options.topBar.rightButtonStyle];
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
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)options {
42
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)options {
51
 	[viewController rnn_setDrawBehindTabBar:[options.bottomTabs.drawBehind getWithDefaultValue:NO] || ![options.bottomTabs.visible getWithDefaultValue:YES]];
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
 	UIViewController* viewController = self.bindedViewController;
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
 		[viewController.tabBarController rnn_setCurrentTabIndex:[viewController.tabBarController.viewControllers indexOfObject:viewController]];
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
 		_navigationButtons = [[RNNNavigationButtons alloc] initWithViewController:(RNNRootViewController*)viewController];
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
 		RCTRootView* rootView = (RCTRootView*)viewController.view;
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 View File

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

lib/ios/ReactNativeNavigationTests/RNNBottomTabPresenterTest.m → lib/ios/ReactNativeNavigationTests/RNNBasePresenterTest.m View File

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

+ 3
- 3
lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m View File

109
 	RNNTestRootViewCreator* creator = [[RNNTestRootViewCreator alloc] init];
109
 	RNNTestRootViewCreator* creator = [[RNNTestRootViewCreator alloc] init];
110
 	
110
 	
111
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
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
 	[vc viewWillAppear:false];
116
 	[vc viewWillAppear:false];
117
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
117
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
133
 	initialOptions.topBar.title.text = [[Text alloc] initWithValue:@"the title"];
133
 	initialOptions.topBar.title.text = [[Text alloc] initWithValue:@"the title"];
134
 	
134
 	
135
 	RNNViewControllerPresenter* presenter = [[RNNViewControllerPresenter alloc] init];
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
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:vc];
138
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:vc];
139
 	[vc viewWillAppear:false];
139
 	[vc viewWillAppear:false];

+ 38
- 7
lib/ios/ReactNativeNavigationTests/RNNNavigationControllerTest.m View File

1
 #import <XCTest/XCTest.h>
1
 #import <XCTest/XCTest.h>
2
+#import <OCMock/OCMock.h>
2
 #import "RNNNavigationController.h"
3
 #import "RNNNavigationController.h"
3
 #import "RNNRootViewController.h"
4
 #import "RNNRootViewController.h"
4
 
5
 
12
 	RNNRootViewController* _vc1;
13
 	RNNRootViewController* _vc1;
13
 	RNNRootViewController* _vc2;
14
 	RNNRootViewController* _vc2;
14
 	UIViewController* _vc3;
15
 	UIViewController* _vc3;
16
+	RNNNavigationOptions* _options;
15
 }
17
 }
16
 
18
 
17
 - (void)setUp {
19
 - (void)setUp {
18
     [super setUp];
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
 	_vc3 = [UIViewController new];
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
 - (void)testInitWithLayoutInfo_shouldBindPresenter {
29
 - (void)testInitWithLayoutInfo_shouldBindPresenter {
29
 }
31
 }
30
 
32
 
31
 - (void)testInitWithLayoutInfo_shouldSetMultipleViewControllers {
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
 	XCTAssertTrue(self.uut.viewControllers.count == 2);
35
 	XCTAssertTrue(self.uut.viewControllers.count == 2);
34
 }
36
 }
35
 
37
 
42
 }
44
 }
43
 
45
 
44
 - (void)testPreferredStatusBarStyle_shouldReturnLeafPreferredStatusBarStyle {
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
 	XCTAssertTrue(self.uut.preferredStatusBarStyle == self.uut.getCurrentChild.preferredStatusBarStyle);
48
 	XCTAssertTrue(self.uut.preferredStatusBarStyle == self.uut.getCurrentChild.preferredStatusBarStyle);
47
 }
49
 }
48
 
50
 
106
 	XCTAssertEqual(self.uut.supportedInterfaceOrientations, self.uut.getCurrentChild.supportedInterfaceOrientations);
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
 - (RNNNavigationController *)createNavigationControllerWithOptions:(RNNNavigationOptions *)options {
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
 @end
144
 @end

+ 31
- 15
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m View File

1
 #import <XCTest/XCTest.h>
1
 #import <XCTest/XCTest.h>
2
+#import <OCMock/OCMock.h>
2
 #import "RNNRootViewController.h"
3
 #import "RNNRootViewController.h"
3
 #import "RNNReactRootViewCreator.h"
4
 #import "RNNReactRootViewCreator.h"
4
 #import "RNNTestRootViewCreator.h"
5
 #import "RNNTestRootViewCreator.h"
48
 	layoutInfo.componentId = self.componentId;
49
 	layoutInfo.componentId = self.componentId;
49
 	layoutInfo.name = self.pageName;
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
 -(void)testTopBarBackgroundColor_validColor{
56
 -(void)testTopBarBackgroundColor_validColor{
195
 	XCTAssertFalse(transparentView);
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
 -(void)testTopBarLargeTitle_true {
205
 -(void)testTopBarLargeTitle_true {
205
 	self.options.topBar.largeTitle.visible = [[Bool alloc] initWithValue:@(1)];
206
 	self.options.topBar.largeTitle.visible = [[Bool alloc] initWithValue:@(1)];
538
 	XCTAssertNotNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
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
 #pragma mark BottomTabs
565
 #pragma mark BottomTabs
550
 
566
 
551
 
567
 
552
 - (RNNNavigationController *)createNavigationController {
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
 	return nav;
571
 	return nav;
556
 }
572
 }

+ 9
- 9
lib/ios/ReactNativeNavigationTests/RNNTabBarControllerTest.m View File

26
 	self.mockTabBarPresenter = [OCMockObject partialMockForObject:[[RNNTabBarPresenter alloc] init]];
26
 	self.mockTabBarPresenter = [OCMockObject partialMockForObject:[[RNNTabBarPresenter alloc] init]];
27
 	self.mockChildViewController = [OCMockObject partialMockForObject:[RNNRootViewController new]];
27
 	self.mockChildViewController = [OCMockObject partialMockForObject:[RNNRootViewController new]];
28
 	self.mockEventEmmiter = [OCMockObject partialMockForObject:[RNNEventEmitter new]];
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
 	OCMStub([self.mockUut selectedViewController]).andReturn(self.mockChildViewController);
30
 	OCMStub([self.mockUut selectedViewController]).andReturn(self.mockChildViewController);
31
 }
31
 }
32
 
32
 
38
 	UIViewController* vc1 = [[UIViewController alloc] init];
38
 	UIViewController* vc1 = [[UIViewController alloc] init];
39
 	UIViewController* vc2 = [[UIViewController alloc] init];
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
 	XCTAssertTrue(uut.viewControllers.count == 2);
42
 	XCTAssertTrue(uut.viewControllers.count == 2);
43
 }
43
 }
44
 
44
 
48
 	RNNTabBarPresenter* presenter = [[RNNTabBarPresenter alloc] init];
48
 	RNNTabBarPresenter* presenter = [[RNNTabBarPresenter alloc] init];
49
 	NSArray* childViewControllers = @[[UIViewController new]];
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
 	XCTAssertTrue(uut.layoutInfo == layoutInfo);
52
 	XCTAssertTrue(uut.layoutInfo == layoutInfo);
53
 	XCTAssertTrue(uut.options == options);
53
 	XCTAssertTrue(uut.options == options);
54
 	XCTAssertTrue(uut.presenter == presenter);
54
 	XCTAssertTrue(uut.presenter == presenter);
63
 
63
 
64
 	NSArray* childViewControllers = @[[UIViewController new]];
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
 	XCTAssertTrue(uut.layoutInfo == layoutInfo);
67
 	XCTAssertTrue(uut.layoutInfo == layoutInfo);
68
 	XCTAssertTrue(uut.options == options);
68
 	XCTAssertTrue(uut.options == options);
69
 	XCTAssertTrue(uut.presenter == presenter);
69
 	XCTAssertTrue(uut.presenter == presenter);
72
 }
72
 }
73
 
73
 
74
 - (void)testInitWithLayoutInfo_shouldSetDelegate {
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
 	XCTAssertTrue(uut.delegate == uut);
77
 	XCTAssertTrue(uut.delegate == uut);
78
 }
78
 }
79
 
79
 
80
 - (void)testWillMoveToParent_invokePresenterApplyOptionsOnWillMoveToParent {
80
 - (void)testWillMoveToParent_invokePresenterApplyOptionsOnWillMoveToParent {
81
-	[[self.mockTabBarPresenter expect] applyOptionsOnWillMoveToParentViewController:[(RNNTabBarController *)self.mockUut options]];
81
+	[[self.mockTabBarPresenter expect] applyOptionsOnWillMoveToParentViewController:[(RNNTabBarController *)self.mockUut resolveOptions]];
82
 	[self.mockUut willMoveToParentViewController:[UIViewController new]];
82
 	[self.mockUut willMoveToParentViewController:[UIViewController new]];
83
 	[self.mockTabBarPresenter verify];
83
 	[self.mockTabBarPresenter verify];
84
 }
84
 }
98
 - (void)testMergeOptions_shouldInvokePresenterMergeOptions {
98
 - (void)testMergeOptions_shouldInvokePresenterMergeOptions {
99
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{}];
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
 	[(RNNTabBarController *)self.mockUut mergeOptions:options];
102
 	[(RNNTabBarController *)self.mockUut mergeOptions:options];
103
 	[self.mockTabBarPresenter verify];
103
 	[self.mockTabBarPresenter verify];
104
 }
104
 }
160
 	RNNLayoutInfo* layoutInfo = [RNNLayoutInfo new];
160
 	RNNLayoutInfo* layoutInfo = [RNNLayoutInfo new];
161
 	layoutInfo.componentId = @"componentId";
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
 	[uut setSelectedIndexByComponentID:@"componentId"];
166
 	[uut setSelectedIndexByComponentID:@"componentId"];
167
 	XCTAssertTrue(uut.selectedIndex == 1);
167
 	XCTAssertTrue(uut.selectedIndex == 1);
168
 }
168
 }