hybrid-navigation 2.12.4 → 2.13.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/GardenModule.java +6 -2
- package/android/src/main/java/com/reactnative/hybridnavigation/NavigationModule.java +29 -30
- package/android/src/main/java/com/reactnative/hybridnavigation/Navigator.java +2 -3
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactBridgeManager.java +4 -4
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/DrawerNavigator.java +6 -6
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java +24 -33
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/StackNavigator.java +22 -22
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/TabNavigator.java +8 -8
- package/ios/HybridNavigation/GlobalStyle.h +0 -8
- package/ios/HybridNavigation/GlobalStyle.m +2 -8
- package/ios/HybridNavigation/HBDAnimationObserver.h +24 -0
- package/ios/HybridNavigation/HBDAnimationObserver.m +45 -0
- package/ios/HybridNavigation/HBDUtils.h +5 -13
- package/ios/HybridNavigation/HBDUtils.m +26 -12
- package/ios/HybridNavigation/Navigator/HBDDrawerNavigator.h +0 -9
- package/ios/HybridNavigation/Navigator/HBDDrawerNavigator.m +91 -67
- package/ios/HybridNavigation/Navigator/HBDNavigatorRegistry.h +2 -7
- package/ios/HybridNavigation/Navigator/HBDNavigatorRegistry.m +28 -26
- package/ios/HybridNavigation/Navigator/HBDScreenNavigator.h +0 -9
- package/ios/HybridNavigation/Navigator/HBDScreenNavigator.m +132 -99
- package/ios/HybridNavigation/Navigator/HBDStackNavigator.h +0 -9
- package/ios/HybridNavigation/Navigator/HBDStackNavigator.m +203 -142
- package/ios/HybridNavigation/Navigator/HBDTabNavigator.h +0 -9
- package/ios/HybridNavigation/Navigator/HBDTabNavigator.m +144 -124
- package/ios/HybridNavigation/{Bridge → ReactBridge}/HBDEventEmitter.h +1 -11
- package/ios/HybridNavigation/{Bridge → ReactBridge}/HBDEventEmitter.m +4 -10
- package/ios/HybridNavigation/ReactBridge/HBDGardenModule.h +6 -0
- package/ios/HybridNavigation/ReactBridge/HBDGardenModule.m +161 -0
- package/ios/HybridNavigation/ReactBridge/HBDNavigationModule.h +6 -0
- package/ios/HybridNavigation/ReactBridge/HBDNavigationModule.m +239 -0
- package/ios/HybridNavigation/ReactBridge/HBDNavigator.h +20 -0
- package/ios/HybridNavigation/{Bridge → ReactBridge}/HBDReactBridgeManager.h +12 -20
- package/ios/HybridNavigation/{Bridge → ReactBridge}/HBDReactBridgeManager.m +91 -91
- package/ios/HybridNavigation/View/HBDBarButtonItem.h +0 -8
- package/ios/HybridNavigation/View/HBDBarButtonItem.m +1 -11
- package/ios/HybridNavigation/View/HBDNavigationBar.h +0 -8
- package/ios/HybridNavigation/View/HBDNavigationBar.m +3 -12
- package/ios/HybridNavigation/View/HBDReactTabBar.h +0 -8
- package/ios/HybridNavigation/View/HBDReactTabBar.m +1 -8
- package/ios/HybridNavigation/View/HBDRootView.h +3 -10
- package/ios/HybridNavigation/View/HBDRootView.m +14 -25
- package/ios/HybridNavigation/View/HBDTitleView.h +0 -9
- package/ios/HybridNavigation/View/HBDTitleView.m +1 -26
- package/ios/HybridNavigation/View/UITabBar+Badge.h +0 -8
- package/ios/HybridNavigation/View/UITabBar+Badge.m +0 -7
- package/ios/HybridNavigation/ViewController/HBDDrawerController.h +0 -8
- package/ios/HybridNavigation/ViewController/HBDDrawerController.m +2 -9
- package/ios/HybridNavigation/ViewController/HBDFadeAnimation.h +9 -0
- package/ios/HybridNavigation/ViewController/HBDFadeAnimation.m +22 -0
- package/ios/HybridNavigation/ViewController/HBDNavigationController.h +0 -8
- package/ios/HybridNavigation/ViewController/HBDNavigationController.m +17 -120
- package/ios/HybridNavigation/ViewController/HBDPopAnimation.h +0 -7
- package/ios/HybridNavigation/ViewController/HBDPopAnimation.m +1 -8
- package/ios/HybridNavigation/ViewController/HBDPushAnimation.h +0 -7
- package/ios/HybridNavigation/ViewController/HBDPushAnimation.m +1 -8
- package/ios/HybridNavigation/ViewController/HBDReactViewController.h +0 -8
- package/ios/HybridNavigation/ViewController/HBDReactViewController.m +60 -27
- package/ios/HybridNavigation/ViewController/HBDTabBarController.h +0 -8
- package/ios/HybridNavigation/ViewController/HBDTabBarController.m +15 -11
- package/ios/HybridNavigation/ViewController/HBDViewController+Garden.m +23 -33
- package/ios/HybridNavigation/ViewController/HBDViewController.h +1 -8
- package/ios/HybridNavigation/ViewController/HBDViewController.m +12 -25
- package/ios/HybridNavigation/ViewController/UINavigationController+HBD.h +0 -8
- package/ios/HybridNavigation/ViewController/UINavigationController+HBD.m +0 -8
- package/ios/HybridNavigation/ViewController/UIViewController+HBD.h +2 -16
- package/ios/HybridNavigation/ViewController/UIViewController+HBD.m +32 -46
- package/lib/Garden.d.ts +3 -0
- package/lib/Garden.js +12 -1
- package/lib/NavigationModule.d.ts +0 -2
- package/lib/NavigationModule.js +0 -3
- package/lib/Navigator.d.ts +25 -25
- package/lib/Navigator.js +116 -73
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +4 -6
- package/src/Garden.ts +15 -1
- package/src/NavigationModule.ts +0 -4
- package/src/Navigator.ts +96 -58
- package/src/index.ts +1 -1
- package/ios/HybridNavigation/Bridge/HBDGardenModule.h +0 -14
- package/ios/HybridNavigation/Bridge/HBDGardenModule.m +0 -155
- package/ios/HybridNavigation/Bridge/HBDNavigationModule.h +0 -15
- package/ios/HybridNavigation/Bridge/HBDNavigationModule.m +0 -272
- package/ios/HybridNavigation/Navigator/HBDNavigator.h +0 -26
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
//
|
|
2
|
-
// HBDStackNavigator.m
|
|
3
|
-
// HybridNavigation
|
|
4
|
-
//
|
|
5
|
-
// Created by Listen on 2018/6/28.
|
|
6
|
-
// Copyright © 2018年 Listen. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
1
|
#import "HBDStackNavigator.h"
|
|
2
|
+
|
|
10
3
|
#import "HBDReactBridgeManager.h"
|
|
11
4
|
#import "HBDNavigationController.h"
|
|
12
5
|
#import "UINavigationController+HBD.h"
|
|
6
|
+
#import "HBDAnimationObserver.h"
|
|
13
7
|
|
|
14
8
|
@implementation HBDStackNavigator
|
|
15
9
|
|
|
@@ -21,177 +15,244 @@
|
|
|
21
15
|
return @[@"push", @"pushLayout", @"pop", @"popTo", @"popToRoot", @"redirectTo"];
|
|
22
16
|
}
|
|
23
17
|
|
|
24
|
-
- (UIViewController *)
|
|
25
|
-
NSDictionary *
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
UIViewController *root = [[HBDReactBridgeManager get] controllerWithLayout:children.firstObject];
|
|
29
|
-
if (root) {
|
|
30
|
-
return [[HBDNavigationController alloc] initWithRootViewController:root];
|
|
31
|
-
}
|
|
18
|
+
- (UIViewController *)viewControllerWithLayout:(NSDictionary *)layout {
|
|
19
|
+
NSDictionary *model = layout[self.name];
|
|
20
|
+
if (!model) {
|
|
21
|
+
return nil;
|
|
32
22
|
}
|
|
33
|
-
|
|
23
|
+
|
|
24
|
+
NSArray *children = model[@"children"];
|
|
25
|
+
UIViewController *vc = [[HBDReactBridgeManager get] viewControllerWithLayout:children.firstObject];
|
|
26
|
+
return [[HBDNavigationController alloc] initWithRootViewController:vc];
|
|
34
27
|
}
|
|
35
28
|
|
|
36
|
-
- (NSDictionary *)
|
|
37
|
-
if ([vc isKindOfClass:[HBDNavigationController class]]) {
|
|
38
|
-
|
|
39
|
-
NSMutableArray *children = [[NSMutableArray alloc] init];
|
|
40
|
-
for (NSUInteger i = 0; i < nav.childViewControllers.count; i++) {
|
|
41
|
-
UIViewController *child = nav.childViewControllers[i];
|
|
42
|
-
NSDictionary *graph = [[HBDReactBridgeManager get] buildRouteGraphWithViewController:child];
|
|
43
|
-
[children addObject:graph];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return @{
|
|
47
|
-
@"layout": @"stack",
|
|
48
|
-
@"sceneId": vc.sceneId,
|
|
49
|
-
@"children": children,
|
|
50
|
-
@"mode": [vc hbd_mode],
|
|
51
|
-
};
|
|
29
|
+
- (NSDictionary *)routeGraphWithViewController:(UIViewController *)vc {
|
|
30
|
+
if (![vc isKindOfClass:[HBDNavigationController class]]) {
|
|
31
|
+
return nil;
|
|
52
32
|
}
|
|
53
|
-
|
|
33
|
+
|
|
34
|
+
HBDNavigationController *nav = (HBDNavigationController *) vc;
|
|
35
|
+
|
|
36
|
+
NSMutableArray *children = [[NSMutableArray alloc] init];
|
|
37
|
+
for (NSUInteger i = 0; i < nav.childViewControllers.count; i++) {
|
|
38
|
+
UIViewController *child = nav.childViewControllers[i];
|
|
39
|
+
NSDictionary *graph = [[HBDReactBridgeManager get] routeGraphWithViewController:child];
|
|
40
|
+
[children addObject:graph];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return @{
|
|
44
|
+
@"layout": @"stack",
|
|
45
|
+
@"sceneId": nav.sceneId,
|
|
46
|
+
@"children": children,
|
|
47
|
+
@"mode": [nav hbd_mode],
|
|
48
|
+
};
|
|
54
49
|
}
|
|
55
50
|
|
|
56
51
|
- (HBDViewController *)primaryViewControllerWithViewController:(UIViewController *)vc {
|
|
57
|
-
if ([vc isKindOfClass:[UINavigationController class]]) {
|
|
58
|
-
|
|
59
|
-
return [[HBDReactBridgeManager get] primaryViewControllerWithViewController:nav.topViewController];
|
|
52
|
+
if (![vc isKindOfClass:[UINavigationController class]]) {
|
|
53
|
+
return nil;
|
|
60
54
|
}
|
|
61
|
-
|
|
55
|
+
UINavigationController *nav = (UINavigationController *)vc;
|
|
56
|
+
return [[HBDReactBridgeManager get] primaryViewControllerWithViewController:nav.topViewController];
|
|
62
57
|
}
|
|
63
58
|
|
|
64
|
-
- (void)handleNavigationWithViewController:(UIViewController *)
|
|
65
|
-
|
|
59
|
+
- (void)handleNavigationWithViewController:(UIViewController *)vc action:(NSString *)action extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
60
|
+
if (!vc.hbd_inViewHierarchy) {
|
|
61
|
+
callback(@[NSNull.null, @NO]);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
UINavigationController *nav = [self navigationControllerForViewController:vc];
|
|
66
66
|
if (!nav) {
|
|
67
|
-
|
|
67
|
+
callback(@[NSNull.null, @NO]);
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
if (nav.transitionCoordinator) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
[selfObj handleNavigationWithViewController:target action:action extras:extras resolver:resolve rejecter:reject];
|
|
72
|
+
[nav.transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
|
|
73
|
+
// empty
|
|
74
|
+
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
|
|
75
|
+
[self handleNavigationWithViewController:vc action:action extras:extras callback:callback];
|
|
77
76
|
}];
|
|
78
77
|
return;
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
if (!nav.hbd_viewAppeared) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
[self performSelector:@selector(handleNavigation:) withObject:@{
|
|
82
|
+
@"viewController": vc,
|
|
83
|
+
@"action": action,
|
|
84
|
+
@"extras": extras,
|
|
85
|
+
@"callback": callback,
|
|
86
|
+
} afterDelay:0.05];
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
UIViewController *viewController = nil;
|
|
90
|
-
|
|
91
90
|
if ([action isEqualToString:@"push"]) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
91
|
+
[self handlePushWithNavigationController:nav extras:extras callback:callback];
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if ([action isEqualToString:@"pop"]) {
|
|
96
|
+
[self handlePopWithNavigationController:nav callback:callback];
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if ([action isEqualToString:@"popTo"]) {
|
|
101
|
+
[self handlePopToWithNavigationController:nav extras:extras callback:callback];
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if ([action isEqualToString:@"popToRoot"]) {
|
|
106
|
+
[self handlePopToRootWithNavigationController:nav extras:extras callback:callback];
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if ([action isEqualToString:@"redirectTo"]) {
|
|
111
|
+
[self handleRedirectToWithNavigationController:nav target:vc extras:extras callback:callback];
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if ([action isEqualToString:@"pushLayout"]) {
|
|
116
|
+
[self handlePushLayoutWithNavigationController:nav extras:extras callback:callback];
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
- (void)handlePushWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
122
|
+
UIViewController *vc = [self viewControllerWithExtras:extras];
|
|
123
|
+
if (!vc) {
|
|
124
|
+
callback(@[NSNull.null, @NO]);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
vc.hidesBottomBarWhenPushed = nav.hidesBottomBarWhenPushed;
|
|
129
|
+
[[HBDAnimationObserver sharedObserver] beginAnimation];
|
|
130
|
+
[nav pushViewController:vc animated:YES];
|
|
131
|
+
[self animateAlongsideTransition:nav callback:callback];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
- (void)handlePopWithNavigationController:(UINavigationController *)nav callback:(RCTResponseSenderBlock)callback {
|
|
135
|
+
[nav popViewControllerAnimated:YES];
|
|
136
|
+
[self animateAlongsideTransition:nav callback:callback];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
- (void)handlePopToWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
140
|
+
UIViewController *vc = [self findViewControllerWithNavigationController:nav extras:extras];
|
|
141
|
+
if (!vc) {
|
|
142
|
+
callback(@[NSNull.null, @NO]);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
[nav popToViewController:vc animated:YES];
|
|
147
|
+
[self animateAlongsideTransition:nav callback:callback];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
- (UIViewController *)findViewControllerWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras {
|
|
151
|
+
NSArray *children = nav.childViewControllers;
|
|
152
|
+
NSString *moduleName = extras[@"moduleName"];
|
|
153
|
+
BOOL inclusive = [extras[@"inclusive"] boolValue];
|
|
154
|
+
|
|
155
|
+
for (NSUInteger i = children.count; i > 0; i--) {
|
|
156
|
+
NSUInteger index = i - 1;
|
|
157
|
+
HBDViewController *vc = children[index];
|
|
158
|
+
if ([moduleName isEqualToString:vc.moduleName] || [moduleName isEqualToString:vc.sceneId]) {
|
|
159
|
+
if (inclusive && index > 0) {
|
|
160
|
+
return children[index - 1];
|
|
121
161
|
}
|
|
162
|
+
return vc;
|
|
122
163
|
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return nil;
|
|
167
|
+
}
|
|
123
168
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
resolve(@(YES));
|
|
135
|
-
};
|
|
136
|
-
[nav popToRootViewControllerAnimated:YES];
|
|
137
|
-
} else if ([action isEqualToString:@"redirectTo"]) {
|
|
138
|
-
viewController = [self createViewControllerWithExtras:extras];
|
|
139
|
-
if (!viewController) {
|
|
140
|
-
resolve(@(NO));
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
viewController.didShowActionBlock = ^{
|
|
144
|
-
resolve(@(YES));
|
|
145
|
-
};
|
|
146
|
-
[nav redirectToViewController:viewController target:target animated:YES];
|
|
147
|
-
} else if ([action isEqualToString:@"pushLayout"]) {
|
|
148
|
-
NSDictionary *layout = extras[@"layout"];
|
|
149
|
-
viewController = [[HBDReactBridgeManager get] controllerWithLayout:layout];
|
|
150
|
-
if (viewController) {
|
|
151
|
-
viewController.hidesBottomBarWhenPushed = nav.hidesBottomBarWhenPushed;
|
|
152
|
-
viewController.didShowActionBlock = ^{
|
|
153
|
-
resolve(@(YES));
|
|
154
|
-
};
|
|
155
|
-
[nav pushViewController:viewController animated:YES];
|
|
156
|
-
} else {
|
|
157
|
-
resolve(@(NO));
|
|
158
|
-
}
|
|
169
|
+
- (void)handlePopToRootWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
170
|
+
[nav popToRootViewControllerAnimated:YES];
|
|
171
|
+
[self animateAlongsideTransition:nav callback:callback];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
- (void)handleRedirectToWithNavigationController:(UINavigationController *)nav target:(UIViewController *)target extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
175
|
+
UIViewController *vc = [self viewControllerWithExtras:extras];
|
|
176
|
+
if (!vc) {
|
|
177
|
+
callback(@[NSNull.null, @NO]);
|
|
178
|
+
return;
|
|
159
179
|
}
|
|
180
|
+
|
|
181
|
+
[[HBDAnimationObserver sharedObserver] beginAnimation];
|
|
182
|
+
[nav redirectToViewController:vc target:target animated:YES];
|
|
183
|
+
[self animateAlongsideTransition:nav callback:callback];
|
|
160
184
|
}
|
|
161
185
|
|
|
162
|
-
- (
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
viewController = [[HBDReactBridgeManager get] controllerWithModuleName:moduleName props:props options:options];
|
|
186
|
+
- (void)handlePushLayoutWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
187
|
+
NSDictionary *layout = extras[@"layout"];
|
|
188
|
+
UIViewController *vc = [[HBDReactBridgeManager get] viewControllerWithLayout:layout];
|
|
189
|
+
if (!vc) {
|
|
190
|
+
callback(@[NSNull.null, @NO]);
|
|
191
|
+
return;
|
|
169
192
|
}
|
|
170
|
-
|
|
193
|
+
|
|
194
|
+
vc.hidesBottomBarWhenPushed = nav.hidesBottomBarWhenPushed;
|
|
195
|
+
[[HBDAnimationObserver sharedObserver] beginAnimation];
|
|
196
|
+
[nav pushViewController:vc animated:YES];
|
|
197
|
+
[self animateAlongsideTransition:nav callback:callback];
|
|
171
198
|
}
|
|
172
199
|
|
|
173
|
-
- (UINavigationController *)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
} else {
|
|
178
|
-
nav = controller.navigationController;
|
|
200
|
+
- (void)animateAlongsideTransition:(UINavigationController *)nav callback:(RCTResponseSenderBlock)callback {
|
|
201
|
+
if (!nav.transitionCoordinator) {
|
|
202
|
+
callback(@[NSNull.null, @YES]);
|
|
203
|
+
return;
|
|
179
204
|
}
|
|
205
|
+
|
|
206
|
+
[nav.transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
|
|
207
|
+
// empty
|
|
208
|
+
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
|
|
209
|
+
callback(@[NSNull.null, @YES]);
|
|
210
|
+
}];
|
|
211
|
+
}
|
|
180
212
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
213
|
+
- (UIViewController *)viewControllerWithExtras:(NSDictionary *)extras {
|
|
214
|
+
NSString *moduleName = extras[@"moduleName"];
|
|
215
|
+
NSDictionary *props = extras[@"props"];
|
|
216
|
+
NSDictionary *options = extras[@"options"];
|
|
217
|
+
return [[HBDReactBridgeManager get] viewControllerWithModuleName:moduleName props:props options:options];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
- (UINavigationController *)navigationControllerForViewController:(UIViewController *)vc {
|
|
221
|
+
if ([vc isKindOfClass:[UINavigationController class]]) {
|
|
222
|
+
return (UINavigationController *)vc;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
UINavigationController *nav = vc.navigationController;
|
|
226
|
+
if (nav) {
|
|
227
|
+
return nav;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
HBDDrawerController *drawer = vc.drawerController;
|
|
231
|
+
if (!drawer) {
|
|
232
|
+
return nil;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if ([drawer.contentController isKindOfClass:[UITabBarController class]]) {
|
|
236
|
+
UITabBarController *tabBar = (UITabBarController *) drawer.contentController;
|
|
237
|
+
if ([tabBar.selectedViewController isKindOfClass:[UINavigationController class]]) {
|
|
238
|
+
return (UINavigationController *)tabBar.selectedViewController;
|
|
192
239
|
}
|
|
240
|
+
return nil;
|
|
193
241
|
}
|
|
194
|
-
|
|
242
|
+
|
|
243
|
+
if ([drawer.contentController isKindOfClass:[UINavigationController class]]) {
|
|
244
|
+
return (UINavigationController *) drawer.contentController;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return nil;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
-(void)handleNavigation:(NSDictionary *)params {
|
|
251
|
+
[self handleNavigationWithViewController:params[@"viewController"] action:params[@"action"] extras:params[@"extras"] callback:params[@"callback"]];
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
- (void)invalidate {
|
|
255
|
+
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
|
195
256
|
}
|
|
196
257
|
|
|
197
258
|
@end
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
//
|
|
2
|
-
// HBDTabNavigator.h
|
|
3
|
-
// HybridNavigation
|
|
4
|
-
//
|
|
5
|
-
// Created by Listen on 2018/6/28.
|
|
6
|
-
// Copyright © 2018年 Listen. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#import <Foundation/Foundation.h>
|
|
10
1
|
#import "HBDNavigator.h"
|
|
11
2
|
|
|
12
3
|
@interface HBDTabNavigator : NSObject <HBDNavigator>
|