hybrid-navigation 2.17.10 → 2.17.12
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/ios/HybridNavigation/Navigator/HBDDrawerNavigator.m +0 -5
- package/ios/HybridNavigation/Navigator/HBDScreenNavigator.m +0 -5
- package/ios/HybridNavigation/Navigator/HBDStackNavigator.m +7 -11
- package/ios/HybridNavigation/Navigator/HBDTabNavigator.m +0 -5
- package/ios/HybridNavigation/ReactBridge/HBDNavigationModule.m +1 -1
- package/ios/HybridNavigation/ReactBridge/HBDReactBridgeManager.m +1 -1
- package/ios/HybridNavigation/ViewController/HBDReactViewController.m +2 -1
- package/ios/HybridNavigation/ViewController/HBDViewController.m +1 -1
- package/ios/HybridNavigation/ViewController/UIViewController+HBD.h +0 -3
- package/ios/HybridNavigation/ViewController/UIViewController+HBD.m +1 -37
- package/package.json +1 -1
|
@@ -83,11 +83,6 @@
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
- (void)handleNavigationWithViewController:(UIViewController *)vc action:(NSString *)action extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
86
|
-
if (!vc.hbd_inViewHierarchy) {
|
|
87
|
-
callback(@[NSNull.null, @NO]);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
86
|
HBDDrawerController *drawer = [vc drawerController];
|
|
92
87
|
if (!drawer) {
|
|
93
88
|
callback(@[NSNull.null, @NO]);
|
|
@@ -50,11 +50,6 @@
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
- (void)handleNavigationWithViewController:(UIViewController *)vc action:(NSString *)action extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
53
|
-
if (!vc.hbd_inViewHierarchy) {
|
|
54
|
-
callback(@[NSNull.null, @NO]);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
53
|
if ([action isEqualToString:@"present"]) {
|
|
59
54
|
[self handlePresentWithViewController:vc extras:extras callback:callback];
|
|
60
55
|
return;
|
|
@@ -59,18 +59,15 @@
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
- (void)handleNavigationWithViewController:(UIViewController *)vc action:(NSString *)action extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
62
|
-
if (!vc.hbd_inViewHierarchy) {
|
|
63
|
-
callback(@[NSNull.null, @NO]);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
62
|
UINavigationController *nav = [self navigationControllerForViewController:vc];
|
|
68
63
|
if (!nav) {
|
|
64
|
+
RCTLogInfo(@"[Navigation] 找不到对应的 UINavigationController from:%@", extras[@"from"]);
|
|
69
65
|
callback(@[NSNull.null, @NO]);
|
|
70
66
|
return;
|
|
71
67
|
}
|
|
72
|
-
|
|
68
|
+
|
|
73
69
|
if (nav.transitionCoordinator) {
|
|
70
|
+
RCTLogInfo(@"[Navigation] 等待上个 action 执行完成 from:%@ %@ to:%@", extras[@"from"], action, extras[@"to"]);
|
|
74
71
|
[nav.transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
|
|
75
72
|
// empty
|
|
76
73
|
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
|
|
@@ -116,6 +113,7 @@
|
|
|
116
113
|
- (void)handlePushWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
117
114
|
UIViewController *vc = [self viewControllerWithExtras:extras];
|
|
118
115
|
if (!vc) {
|
|
116
|
+
RCTLogInfo(@"[Navigation] 无法创建对应的页面 %@", extras[@"moduleName"]);
|
|
119
117
|
callback(@[NSNull.null, @NO]);
|
|
120
118
|
return;
|
|
121
119
|
}
|
|
@@ -157,6 +155,7 @@
|
|
|
157
155
|
- (void)handlePopToWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
158
156
|
UIViewController *vc = [self findViewControllerWithNavigationController:nav extras:extras];
|
|
159
157
|
if (!vc) {
|
|
158
|
+
RCTLogInfo(@"[Navigation] 找不到要 popTo 的页面 %@", extras[@"moduleName"]);
|
|
160
159
|
callback(@[NSNull.null, @NO]);
|
|
161
160
|
return;
|
|
162
161
|
}
|
|
@@ -238,13 +237,9 @@
|
|
|
238
237
|
}
|
|
239
238
|
|
|
240
239
|
- (void)handleRedirectToWithNavigationController:(UINavigationController *)nav target:(UIViewController *)target extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
241
|
-
if (![nav.childViewControllers containsObject:target]) {
|
|
242
|
-
callback(@[NSNull.null, @NO]);
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
240
|
UIViewController *vc = [self viewControllerWithExtras:extras];
|
|
247
241
|
if (!vc) {
|
|
242
|
+
RCTLogInfo(@"[Navigation] 无法创建对应的页面 %@", extras[@"moduleName"]);
|
|
248
243
|
callback(@[NSNull.null, @NO]);
|
|
249
244
|
return;
|
|
250
245
|
}
|
|
@@ -270,6 +265,7 @@
|
|
|
270
265
|
NSDictionary *layout = extras[@"layout"];
|
|
271
266
|
UIViewController *vc = [[HBDReactBridgeManager get] viewControllerWithLayout:layout];
|
|
272
267
|
if (!vc) {
|
|
268
|
+
RCTLogInfo(@"[Navigation] 无法创建对应的 vc");
|
|
273
269
|
callback(@[NSNull.null, @NO]);
|
|
274
270
|
return;
|
|
275
271
|
}
|
|
@@ -175,11 +175,6 @@
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
- (void)handleNavigationWithViewController:(UIViewController *)vc action:(NSString *)action extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
178
|
-
if (!vc.hbd_inViewHierarchy) {
|
|
179
|
-
callback(@[NSNull.null, @NO]);
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
178
|
UITabBarController *tabBarController = [self tabBarControllerForViewController:vc];
|
|
184
179
|
|
|
185
180
|
if (!tabBarController) {
|
|
@@ -85,7 +85,7 @@ RCT_EXPORT_METHOD(dispatch:(NSString *)sceneId action:(NSString *)action extras:
|
|
|
85
85
|
UIViewController *vc = [self.bridgeManager viewControllerBySceneId:sceneId];
|
|
86
86
|
if (!vc) {
|
|
87
87
|
callback(@[NSNull.null, @NO]);
|
|
88
|
-
|
|
88
|
+
RCTLogInfo(@"[Navigation] Can't find target scene for action: %@, maybe the scene is gone. \nextras: %@", action, extras);
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -327,7 +327,7 @@ const NSInteger ResultCancel = 0;
|
|
|
327
327
|
- (void)handleNavigationWithViewController:(UIViewController *)vc action:(NSString *)action extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
328
328
|
id <HBDNavigator> navigator = [self.navigatorRegistry navigatorForAction:action];
|
|
329
329
|
if (!navigator) {
|
|
330
|
-
|
|
330
|
+
RCTLogInfo(@"[Navigation] Can't find a navigator that can handle action '%@'", action);
|
|
331
331
|
callback(@[NSNull.null, @NO]);
|
|
332
332
|
return;
|
|
333
333
|
}
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
- (void)dealloc {
|
|
24
24
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillReloadNotification object:nil];
|
|
25
|
+
RCTLogInfo(@"[Navigation] 销毁页面 %@", self.moduleName);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
- (instancetype)initWithModuleName:(NSString *)moduleName props:(NSDictionary *)props options:(NSDictionary *)options {
|
|
@@ -47,11 +48,11 @@
|
|
|
47
48
|
self.view = [[HBDRootView alloc] initWithRootView:rootView];
|
|
48
49
|
[self.view addSubview:rootView];
|
|
49
50
|
[self updateReactViewConstraints];
|
|
51
|
+
RCTLogInfo(@"[Navigation] 加载页面 %@", self.moduleName);
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
- (void)viewDidLoad {
|
|
53
55
|
[super viewDidLoad];
|
|
54
|
-
|
|
55
56
|
NSDictionary *titleItem = self.options[@"titleItem"];
|
|
56
57
|
if (titleItem && self.navigationController) {
|
|
57
58
|
if (self.hbd_barHidden) {
|
|
@@ -16,9 +16,6 @@
|
|
|
16
16
|
@property(nonatomic, assign, readonly) float hbd_barShadowAlpha;
|
|
17
17
|
@property(nonatomic, assign) BOOL hbd_statusBarHidden;
|
|
18
18
|
|
|
19
|
-
@property(nonatomic, assign) BOOL hbd_viewAppeared;
|
|
20
|
-
@property(nonatomic, assign) BOOL hbd_inViewHierarchy;
|
|
21
|
-
|
|
22
19
|
- (void)hbd_setNeedsUpdateNavigationBar;
|
|
23
20
|
|
|
24
21
|
@property(nonatomic, copy, readonly) NSString *sceneId;
|
|
@@ -15,27 +15,9 @@
|
|
|
15
15
|
Class clazz = [self class];
|
|
16
16
|
hbd_exchangeImplementations(clazz, @selector(presentViewController:animated:completion:), @selector(hbd_presentViewController:animated:completion:));
|
|
17
17
|
hbd_exchangeImplementations(clazz, @selector(dismissViewControllerAnimated:completion:), @selector(hbd_dismissViewControllerAnimated:completion:));
|
|
18
|
-
hbd_exchangeImplementations(clazz, @selector(viewDidAppear:), @selector(hbd_viewDidAppear:));
|
|
19
|
-
hbd_exchangeImplementations(clazz, @selector(viewDidDisappear:), @selector(hbd_viewDidDisappear:));
|
|
20
|
-
hbd_exchangeImplementations(clazz, @selector(didMoveToParentViewController:), @selector(hbd_didMoveToParentViewController:));
|
|
21
18
|
});
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
- (void)hbd_didMoveToParentViewController:(UIViewController *)parent {
|
|
25
|
-
[self hbd_didMoveToParentViewController:parent];
|
|
26
|
-
self.hbd_inViewHierarchy = parent != nil;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
- (void)hbd_viewDidAppear:(BOOL)animated {
|
|
30
|
-
[self hbd_viewDidAppear:animated];
|
|
31
|
-
self.hbd_viewAppeared = YES;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
- (void)hbd_viewDidDisappear:(BOOL)animated {
|
|
35
|
-
[self hbd_viewDidDisappear:animated];
|
|
36
|
-
self.hbd_viewAppeared = NO;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
21
|
- (void)hbd_presentViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(void (^)(void))completion {
|
|
40
22
|
if (![self canPresentViewController]) {
|
|
41
23
|
[self didReceiveResultCode:0 resultData:nil requestCode:viewController.requestCode];
|
|
@@ -51,7 +33,7 @@
|
|
|
51
33
|
- (BOOL)canPresentViewController {
|
|
52
34
|
UIViewController *presented = self.presentedViewController;
|
|
53
35
|
if (presented && !presented.isBeingDismissed) {
|
|
54
|
-
|
|
36
|
+
RCTLogInfo(@"[Navigation] Can't present since the scene had present another scene already.");
|
|
55
37
|
return NO;
|
|
56
38
|
}
|
|
57
39
|
return YES;
|
|
@@ -258,24 +240,6 @@
|
|
|
258
240
|
objc_setAssociatedObject(self, @selector(hbd_swipeBackEnabled), @(enabled), OBJC_ASSOCIATION_COPY_NONATOMIC);
|
|
259
241
|
}
|
|
260
242
|
|
|
261
|
-
- (BOOL)hbd_viewAppeared {
|
|
262
|
-
id obj = objc_getAssociatedObject(self, _cmd);
|
|
263
|
-
return obj ? [obj boolValue] : YES;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
- (void)setHbd_viewAppeared:(BOOL)viewAppeared {
|
|
267
|
-
objc_setAssociatedObject(self, @selector(hbd_viewAppeared), @(viewAppeared), OBJC_ASSOCIATION_COPY_NONATOMIC);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
- (BOOL)hbd_inViewHierarchy {
|
|
271
|
-
id obj = objc_getAssociatedObject(self, _cmd);
|
|
272
|
-
return obj ? [obj boolValue] : YES;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
- (void)setHbd_inViewHierarchy:(BOOL)inViewHierarchy {
|
|
276
|
-
objc_setAssociatedObject(self, @selector(hbd_inViewHierarchy), @(inViewHierarchy), OBJC_ASSOCIATION_COPY_NONATOMIC);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
243
|
- (void)hbd_setNeedsUpdateNavigationBar {
|
|
280
244
|
if (self.navigationController && [self.navigationController isKindOfClass:[HBDNavigationController class]]) {
|
|
281
245
|
HBDNavigationController *nav = (HBDNavigationController *) self.navigationController;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hybrid-navigation",
|
|
3
3
|
"description": "React Native Navigation that supports seamless navigation between Native and React.",
|
|
4
|
-
"version": "2.17.
|
|
4
|
+
"version": "2.17.12",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
7
7
|
"react-native": "src/index",
|