|
@@ -4,12 +4,14 @@
|
4
|
4
|
#import "RNNCustomTitleView.h"
|
5
|
5
|
#import "TopBarPresenterCreator.h"
|
6
|
6
|
#import "RNNReactBackgroundView.h"
|
|
7
|
+#import "InteractivePopGestureDelegate.h"
|
7
|
8
|
|
8
|
9
|
@interface RNNStackPresenter() {
|
9
|
10
|
RNNReactComponentRegistry* _componentRegistry;
|
10
|
11
|
UIView* _customTopBarBackground;
|
11
|
12
|
RNNReactView* _topBarBackgroundReactView;
|
12
|
13
|
TopBarPresenter* _topBarPresenter;
|
|
14
|
+ InteractivePopGestureDelegate *_interactivePopGestureDelegate;
|
13
|
15
|
}
|
14
|
16
|
|
15
|
17
|
@property (nonatomic, weak) RNNStackController* stackController;
|
|
@@ -20,12 +22,15 @@
|
20
|
22
|
- (instancetype)initWithComponentRegistry:(RNNReactComponentRegistry *)componentRegistry defaultOptions:(RNNNavigationOptions *)defaultOptions {
|
21
|
23
|
self = [super initWithDefaultOptions:defaultOptions];
|
22
|
24
|
_componentRegistry = componentRegistry;
|
|
25
|
+ _interactivePopGestureDelegate = [InteractivePopGestureDelegate new];
|
23
|
26
|
return self;
|
24
|
27
|
}
|
25
|
28
|
|
26
|
|
-- (void)bindViewController:(UIViewController *)boundViewController {
|
|
29
|
+- (void)bindViewController:(UINavigationController *)boundViewController {
|
27
|
30
|
[super bindViewController:boundViewController];
|
28
|
31
|
_topBarPresenter = [TopBarPresenterCreator createWithBoundedNavigationController:self.stackController];
|
|
32
|
+ _interactivePopGestureDelegate.navigationController = boundViewController;
|
|
33
|
+ _interactivePopGestureDelegate.originalDelegate = boundViewController.interactivePopGestureRecognizer.delegate;
|
29
|
34
|
}
|
30
|
35
|
|
31
|
36
|
- (void)componentDidAppear {
|
|
@@ -45,13 +50,10 @@
|
45
|
50
|
RNNStackController* stack = self.stackController;
|
46
|
51
|
RNNNavigationOptions * withDefault = [options withDefault:[self defaultOptions]];
|
47
|
52
|
|
48
|
|
- self.interactivePopGestureDelegate = [InteractivePopGestureDelegate new];
|
49
|
|
- self.interactivePopGestureDelegate.navigationController = stack;
|
50
|
|
- self.interactivePopGestureDelegate.originalDelegate = stack.interactivePopGestureRecognizer.delegate;
|
51
|
|
- stack.interactivePopGestureRecognizer.delegate = self.interactivePopGestureDelegate;
|
|
53
|
+ [_interactivePopGestureDelegate setEnabled:[withDefault.popGesture getWithDefaultValue:YES]];
|
|
54
|
+ stack.interactivePopGestureRecognizer.delegate = _interactivePopGestureDelegate;
|
52
|
55
|
|
53
|
56
|
[stack setBarStyle:[RCTConvert UIBarStyle:[withDefault.topBar.barStyle getWithDefaultValue:@"default"]]];
|
54
|
|
- [stack setInteractivePopGestureEnabled:[withDefault.popGesture getWithDefaultValue:YES]];
|
55
|
57
|
[stack setRootBackgroundImage:[withDefault.rootBackgroundImage getWithDefaultValue:nil]];
|
56
|
58
|
[stack setNavigationBarTestId:[withDefault.topBar.testID getWithDefaultValue:nil]];
|
57
|
59
|
[stack setNavigationBarVisible:[withDefault.topBar.visible getWithDefaultValue:YES] animated:[withDefault.topBar.animate getWithDefaultValue:YES]];
|
|
@@ -84,7 +86,7 @@
|
84
|
86
|
RNNStackController* stack = self.stackController;
|
85
|
87
|
|
86
|
88
|
if (options.popGesture.hasValue) {
|
87
|
|
- [stack setInteractivePopGestureEnabled:options.popGesture.get];
|
|
89
|
+ [_interactivePopGestureDelegate setEnabled:options.popGesture.get];
|
88
|
90
|
}
|
89
|
91
|
|
90
|
92
|
if (options.rootBackgroundImage.hasValue) {
|