|
@@ -1,9 +1,7 @@
|
1
|
1
|
#import "RNNNavigationControllerPresenter.h"
|
2
|
2
|
#import "UINavigationController+RNNOptions.h"
|
3
|
3
|
#import "RNNNavigationController.h"
|
4
|
|
-#import <React/RCTConvert.h>
|
5
|
4
|
#import "RNNCustomTitleView.h"
|
6
|
|
-#import "UIViewController+LayoutProtocol.h"
|
7
|
5
|
|
8
|
6
|
@interface RNNNavigationControllerPresenter() {
|
9
|
7
|
RNNReactComponentRegistry* _componentRegistry;
|
|
@@ -25,44 +23,43 @@
|
25
|
23
|
[super applyOptions:options];
|
26
|
24
|
|
27
|
25
|
RNNNavigationController* navigationController = self.boundViewController;
|
|
26
|
+ RNNNavigationOptions * withDefault = [options withDefault:[self defaultOptions]];
|
28
|
27
|
|
29
|
28
|
self.interactivePopGestureDelegate = [InteractivePopGestureDelegate new];
|
30
|
29
|
self.interactivePopGestureDelegate.navigationController = navigationController;
|
31
|
30
|
self.interactivePopGestureDelegate.originalDelegate = navigationController.interactivePopGestureRecognizer.delegate;
|
32
|
31
|
navigationController.interactivePopGestureRecognizer.delegate = self.interactivePopGestureDelegate;
|
33
|
32
|
|
34
|
|
- [navigationController rnn_setInteractivePopGestureEnabled:[options.popGesture getWithDefaultValue:YES]];
|
35
|
|
- [navigationController rnn_setRootBackgroundImage:[options.rootBackgroundImage getWithDefaultValue:nil]];
|
36
|
|
- [navigationController rnn_setNavigationBarTestID:[options.topBar.testID getWithDefaultValue:nil]];
|
37
|
|
- [navigationController rnn_setNavigationBarVisible:[options.topBar.visible getWithDefaultValue:YES] animated:[options.topBar.animate getWithDefaultValue:YES]];
|
38
|
|
- [navigationController rnn_hideBarsOnScroll:[options.topBar.hideOnScroll getWithDefaultValue:NO]];
|
39
|
|
- [navigationController rnn_setNavigationBarNoBorder:[options.topBar.noBorder getWithDefaultValue:NO]];
|
40
|
|
- [navigationController rnn_setBarStyle:[RCTConvert UIBarStyle:[options.topBar.barStyle getWithDefaultValue:@"default"]]];
|
41
|
|
- [navigationController rnn_setNavigationBarTranslucent:[options.topBar.background.translucent getWithDefaultValue:NO]];
|
42
|
|
- [navigationController rnn_setNavigationBarClipsToBounds:[options.topBar.background.clipToBounds getWithDefaultValue:NO]];
|
43
|
|
- [navigationController rnn_setNavigationBarBlur:[options.topBar.background.blur getWithDefaultValue:NO]];
|
44
|
|
- [navigationController setTopBarBackgroundColor:[options.topBar.background.color getWithDefaultValue:nil]];
|
45
|
|
- [navigationController rnn_setNavigationBarLargeTitleVisible:[options.topBar.largeTitle.visible getWithDefaultValue:NO]];
|
46
|
|
- [navigationController rnn_setNavigationBarLargeTitleFontFamily:[options.topBar.largeTitle.fontFamily getWithDefaultValue:nil] fontSize:[options.topBar.largeTitle.fontSize getWithDefaultValue:nil] color:[options.topBar.largeTitle.color getWithDefaultValue:nil]];
|
47
|
|
- [navigationController rnn_setNavigationBarFontFamily:[options.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[options.topBar.title.fontSize getWithDefaultValue:nil] color:[options.topBar.title.color getWithDefaultValue:nil]];
|
48
|
|
- [navigationController rnn_setBackButtonColor:[options.topBar.backButton.color getWithDefaultValue:nil]];
|
49
|
|
-}
|
50
|
|
-
|
51
|
|
-- (void)applyOptionsOnWillMoveToParentViewController:(RNNNavigationOptions *)options {
|
52
|
|
- [super applyOptionsOnWillMoveToParentViewController:options];
|
|
33
|
+ [navigationController rnn_setInteractivePopGestureEnabled:[withDefault.popGesture getWithDefaultValue:YES]];
|
|
34
|
+ [navigationController rnn_setRootBackgroundImage:[withDefault.rootBackgroundImage getWithDefaultValue:nil]];
|
|
35
|
+ [navigationController rnn_setNavigationBarTestID:[withDefault.topBar.testID getWithDefaultValue:nil]];
|
|
36
|
+ [navigationController rnn_setNavigationBarVisible:[withDefault.topBar.visible getWithDefaultValue:YES] animated:[withDefault.topBar.animate getWithDefaultValue:YES]];
|
|
37
|
+ [navigationController rnn_hideBarsOnScroll:[withDefault.topBar.hideOnScroll getWithDefaultValue:NO]];
|
|
38
|
+ [navigationController rnn_setNavigationBarNoBorder:[withDefault.topBar.noBorder getWithDefaultValue:NO]];
|
|
39
|
+ [navigationController rnn_setBarStyle:[RCTConvert UIBarStyle:[withDefault.topBar.barStyle getWithDefaultValue:@"default"]]];
|
|
40
|
+ [navigationController rnn_setNavigationBarTranslucent:[withDefault.topBar.background.translucent getWithDefaultValue:NO]];
|
|
41
|
+ [navigationController rnn_setNavigationBarClipsToBounds:[withDefault.topBar.background.clipToBounds getWithDefaultValue:NO]];
|
|
42
|
+ [navigationController rnn_setNavigationBarBlur:[withDefault.topBar.background.blur getWithDefaultValue:NO]];
|
|
43
|
+ [navigationController setTopBarBackgroundColor:[withDefault.topBar.background.color getWithDefaultValue:nil]];
|
|
44
|
+ [navigationController rnn_setNavigationBarLargeTitleVisible:[withDefault.topBar.largeTitle.visible getWithDefaultValue:NO]];
|
|
45
|
+ [navigationController rnn_setNavigationBarLargeTitleFontFamily:[withDefault.topBar.largeTitle.fontFamily getWithDefaultValue:nil] fontSize:[withDefault.topBar.largeTitle.fontSize getWithDefaultValue:nil] color:[withDefault.topBar.largeTitle.color getWithDefaultValue:nil]];
|
|
46
|
+ [navigationController rnn_setNavigationBarFontFamily:[withDefault.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[withDefault.topBar.title.fontSize getWithDefaultValue:nil] color:[withDefault.topBar.title.color getWithDefaultValue:nil]];
|
|
47
|
+ [navigationController rnn_setBackButtonColor:[withDefault.topBar.backButton.color getWithDefaultValue:nil]];
|
53
|
48
|
}
|
54
|
49
|
|
55
|
50
|
- (void)applyOptionsOnViewDidLayoutSubviews:(RNNNavigationOptions *)options {
|
56
|
|
- if (options.topBar.background.component.name.hasValue) {
|
|
51
|
+ RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
|
|
52
|
+ if (withDefault.topBar.background.component.name.hasValue) {
|
57
|
53
|
[self presentBackgroundComponent];
|
58
|
54
|
}
|
59
|
55
|
}
|
60
|
56
|
|
61
|
57
|
- (void)applyOptionsBeforePopping:(RNNNavigationOptions *)options {
|
|
58
|
+ RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
|
62
|
59
|
RNNNavigationController* navigationController = self.boundViewController;
|
63
|
|
- [navigationController setTopBarBackgroundColor:[options.topBar.background.color getWithDefaultValue:nil]];
|
64
|
|
- [navigationController rnn_setNavigationBarFontFamily:[options.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[options.topBar.title.fontSize getWithDefaultValue:nil] color:[options.topBar.title.color getWithDefaultValue:[UIColor blackColor]]];
|
65
|
|
- [navigationController rnn_setNavigationBarLargeTitleVisible:[options.topBar.largeTitle.visible getWithDefaultValue:NO]];
|
|
60
|
+ [navigationController setTopBarBackgroundColor:[withDefault.topBar.background.color getWithDefaultValue:nil]];
|
|
61
|
+ [navigationController rnn_setNavigationBarFontFamily:[withDefault.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[withDefault.topBar.title.fontSize getWithDefaultValue:nil] color:[withDefault.topBar.title.color getWithDefaultValue:[UIColor blackColor]]];
|
|
62
|
+ [navigationController rnn_setNavigationBarLargeTitleVisible:[withDefault.topBar.largeTitle.visible getWithDefaultValue:NO]];
|
66
|
63
|
}
|
67
|
64
|
|
68
|
65
|
- (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions {
|