Browse Source

Resolving buttons options with the component options - fixes styles

yogevbd 6 years ago
parent
commit
3f023adc8d

+ 1
- 1
lib/ios/RNNBasePresenter.h View File

12
 
12
 
13
 - (void)applyOptionsOnWillMoveToParentViewController:(RNNNavigationOptions *)options;
13
 - (void)applyOptionsOnWillMoveToParentViewController:(RNNNavigationOptions *)options;
14
 
14
 
15
-- (void)mergeOptions:(RNNNavigationOptions *)options;
15
+- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions;
16
 
16
 
17
 - (void)setDefaultOptions:(RNNNavigationOptions *)defaultOptions;
17
 - (void)setDefaultOptions:(RNNNavigationOptions *)defaultOptions;
18
 
18
 

+ 1
- 1
lib/ios/RNNBasePresenter.m View File

28
 	[self.bottomTabPresenter applyOptions:initialOptions];
28
 	[self.bottomTabPresenter applyOptions:initialOptions];
29
 }
29
 }
30
 
30
 
31
-- (void)mergeOptions:(RNNNavigationOptions *)options {
31
+- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
32
 	
32
 	
33
 }
33
 }
34
 
34
 

+ 1
- 1
lib/ios/RNNNavigationController.m View File

43
 }
43
 }
44
 
44
 
45
 - (void)mergeOptions:(RNNNavigationOptions *)options {
45
 - (void)mergeOptions:(RNNNavigationOptions *)options {
46
-	[_presenter mergeOptions:options];
46
+	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
47
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
47
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
48
 }
48
 }
49
 
49
 

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

29
 	[navigationController rnn_setNavigationBarFontFamily:[options.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[options.topBar.title.fontSize getWithDefaultValue:nil] color:[options.topBar.title.color getWithDefaultValue:nil]];
29
 	[navigationController rnn_setNavigationBarFontFamily:[options.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[options.topBar.title.fontSize getWithDefaultValue:nil] color:[options.topBar.title.color getWithDefaultValue:nil]];
30
 }
30
 }
31
 
31
 
32
-- (void)mergeOptions:(RNNNavigationOptions *)options {
33
-	[super mergeOptions:options];
32
+- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
33
+	[super mergeOptions:options resolvedOptions:resolvedOptions];
34
 	
34
 	
35
 	RNNNavigationController* navigationController = self.bindedViewController;
35
 	RNNNavigationController* navigationController = self.bindedViewController;
36
 	RNNNavigationOptions* withDefault = (RNNNavigationOptions *)[options withDefault:self.defaultOptions];
36
 	RNNNavigationOptions* withDefault = (RNNNavigationOptions *)[options withDefault:self.defaultOptions];

+ 1
- 1
lib/ios/RNNRootViewController.m View File

69
 }
69
 }
70
 
70
 
71
 - (void)mergeOptions:(RNNNavigationOptions *)options {
71
 - (void)mergeOptions:(RNNNavigationOptions *)options {
72
-	[_presenter mergeOptions:options];
72
+	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
73
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
73
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
74
 	
74
 	
75
 	[self initCustomViews];
75
 	[self initCustomViews];

+ 1
- 1
lib/ios/RNNSideMenuChildVC.m View File

44
 }
44
 }
45
 
45
 
46
 - (void)mergeOptions:(RNNNavigationOptions *)options {
46
 - (void)mergeOptions:(RNNNavigationOptions *)options {
47
-	[_presenter mergeOptions:options];
47
+	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
48
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
48
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
49
 }
49
 }
50
 
50
 

+ 1
- 1
lib/ios/RNNSideMenuController.m View File

59
 }
59
 }
60
 
60
 
61
 - (void)mergeOptions:(RNNNavigationOptions *)options {
61
 - (void)mergeOptions:(RNNNavigationOptions *)options {
62
-	[_presenter mergeOptions:options];
62
+	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
63
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
63
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
64
 }
64
 }
65
 
65
 

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

25
 	}
25
 	}
26
 }
26
 }
27
 
27
 
28
-- (void)mergeOptions:(RNNNavigationOptions *)options {
29
-	[super mergeOptions:options];
28
+- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
29
+	[super mergeOptions:options resolvedOptions:resolvedOptions];
30
 	
30
 	
31
 	RNNSideMenuController* sideMenuController = self.bindedViewController;
31
 	RNNSideMenuController* sideMenuController = self.bindedViewController;
32
 	
32
 	

+ 1
- 1
lib/ios/RNNSplitViewController.m View File

28
 }
28
 }
29
 
29
 
30
 - (void)mergeOptions:(RNNNavigationOptions *)options {
30
 - (void)mergeOptions:(RNNNavigationOptions *)options {
31
-	[_presenter mergeOptions:options];
31
+	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
32
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
32
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
33
 }
33
 }
34
 
34
 

+ 1
- 1
lib/ios/RNNTabBarController.m View File

62
 }
62
 }
63
 
63
 
64
 - (void)mergeOptions:(RNNNavigationOptions *)options {
64
 - (void)mergeOptions:(RNNNavigationOptions *)options {
65
-	[_presenter mergeOptions:options];
65
+	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
66
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
66
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
67
 }
67
 }
68
 
68
 

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

13
 	[tabBarController rnn_setTabBarTestID:[options.bottomTabs.testID getWithDefaultValue:nil]];
13
 	[tabBarController rnn_setTabBarTestID:[options.bottomTabs.testID getWithDefaultValue:nil]];
14
 }
14
 }
15
 
15
 
16
-- (void)mergeOptions:(RNNNavigationOptions *)options {
17
-	[super mergeOptions:options];
16
+- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
17
+	[super mergeOptions:options resolvedOptions:resolvedOptions];
18
 	
18
 	
19
 	UITabBarController* tabBarController = self.bindedViewController;
19
 	UITabBarController* tabBarController = self.bindedViewController;
20
 	
20
 	

+ 1
- 1
lib/ios/RNNTopTabsViewController.m View File

49
 }
49
 }
50
 
50
 
51
 - (void)mergeOptions:(RNNNavigationOptions *)options {
51
 - (void)mergeOptions:(RNNNavigationOptions *)options {
52
-	[_presenter mergeOptions:options];
52
+	[_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
53
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
53
 	[((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
54
 }
54
 }
55
 
55
 

+ 4
- 3
lib/ios/RNNViewControllerPresenter.m View File

44
 	
44
 	
45
 }
45
 }
46
 
46
 
47
-- (void)mergeOptions:(RNNNavigationOptions *)options {
48
-	[super mergeOptions:options];
47
+- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
48
+	[super mergeOptions:options resolvedOptions:resolvedOptions];
49
 	
49
 	
50
 	RNNNavigationOptions* withDefault = (RNNNavigationOptions *)[options withDefault:self.defaultOptions];
50
 	RNNNavigationOptions* withDefault = (RNNNavigationOptions *)[options withDefault:self.defaultOptions];
51
 	
51
 	
112
 	}
112
 	}
113
 	
113
 	
114
 	if (options.topBar.leftButtons || options.topBar.rightButtons) {
114
 	if (options.topBar.leftButtons || options.topBar.rightButtons) {
115
+		RNNNavigationOptions* buttonsResolvedOptions = (RNNNavigationOptions *)[[resolvedOptions overrideOptions:options] withDefault:self.defaultOptions];
115
 		_navigationButtons = [[RNNNavigationButtons alloc] initWithViewController:(RNNRootViewController*)viewController];
116
 		_navigationButtons = [[RNNNavigationButtons alloc] initWithViewController:(RNNRootViewController*)viewController];
116
-		[_navigationButtons applyLeftButtons:options.topBar.leftButtons rightButtons:options.topBar.rightButtons defaultLeftButtonStyle:withDefault.topBar.leftButtonStyle defaultRightButtonStyle:withDefault.topBar.rightButtonStyle];
117
+		[_navigationButtons applyLeftButtons:options.topBar.leftButtons rightButtons:options.topBar.rightButtons defaultLeftButtonStyle:buttonsResolvedOptions.topBar.leftButtonStyle defaultRightButtonStyle:buttonsResolvedOptions.topBar.rightButtonStyle];
117
 	}
118
 	}
118
 }
119
 }
119
 
120