hybrid-navigation 2.17.9 → 2.17.11
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/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +3 -1
- package/ios/HybridNavigation/Navigator/HBDStackNavigator.m +11 -9
- 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 -1
- package/ios/HybridNavigation/ViewController/UIViewController+HBD.m +1 -21
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -33,5 +33,5 @@ dependencies {
|
|
|
33
33
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
34
34
|
implementation 'com.facebook.react:react-native:+'
|
|
35
35
|
// api project(':navigation')
|
|
36
|
-
api 'io.github.listenzz:AndroidNavigation:13.7.
|
|
36
|
+
api 'io.github.listenzz:AndroidNavigation:13.7.3'
|
|
37
37
|
}
|
|
@@ -13,6 +13,7 @@ import static com.reactnative.hybridnavigation.HBDEventEmitter.ON_COMPONENT_DISA
|
|
|
13
13
|
import static com.reactnative.hybridnavigation.HBDEventEmitter.ON_COMPONENT_RESULT;
|
|
14
14
|
|
|
15
15
|
import android.annotation.SuppressLint;
|
|
16
|
+
import android.app.Activity;
|
|
16
17
|
import android.content.pm.ActivityInfo;
|
|
17
18
|
import android.graphics.Color;
|
|
18
19
|
import android.os.Bundle;
|
|
@@ -147,7 +148,8 @@ public class ReactFragment extends HybridFragment implements ReactBridgeManager.
|
|
|
147
148
|
@Override
|
|
148
149
|
public void onStop() {
|
|
149
150
|
if (isRemoving() && forceScreenLandscape()) {
|
|
150
|
-
requireActivity()
|
|
151
|
+
Activity activity = requireActivity();
|
|
152
|
+
activity.getWindow().getDecorView().postDelayed(() -> activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT), 10);
|
|
151
153
|
}
|
|
152
154
|
super.onStop();
|
|
153
155
|
}
|
|
@@ -59,18 +59,21 @@
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
- (void)handleNavigationWithViewController:(UIViewController *)vc action:(NSString *)action extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
62
|
-
|
|
62
|
+
UINavigationController *nav = [self navigationControllerForViewController:vc];
|
|
63
|
+
if (!nav) {
|
|
64
|
+
RCTLogInfo(@"[Navigation] 找不到对应的 UINavigationController from:%@", extras[@"from"]);
|
|
63
65
|
callback(@[NSNull.null, @NO]);
|
|
64
66
|
return;
|
|
65
67
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
|
|
69
|
+
if (![nav.childViewControllers containsObject:vc]) {
|
|
70
|
+
RCTLogInfo(@"[Navigation] 找不到对应的 action target %@", extras[@"from"]);
|
|
69
71
|
callback(@[NSNull.null, @NO]);
|
|
70
72
|
return;
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
if (nav.transitionCoordinator) {
|
|
76
|
+
RCTLogInfo(@"[Navigation] 等待上个 action 执行完成 from:%@ %@ to:%@", extras[@"from"], action, extras[@"to"]);
|
|
74
77
|
[nav.transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
|
|
75
78
|
// empty
|
|
76
79
|
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
|
|
@@ -116,6 +119,7 @@
|
|
|
116
119
|
- (void)handlePushWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
117
120
|
UIViewController *vc = [self viewControllerWithExtras:extras];
|
|
118
121
|
if (!vc) {
|
|
122
|
+
RCTLogInfo(@"[Navigation] 无法创建对应的页面 %@", extras[@"moduleName"]);
|
|
119
123
|
callback(@[NSNull.null, @NO]);
|
|
120
124
|
return;
|
|
121
125
|
}
|
|
@@ -157,6 +161,7 @@
|
|
|
157
161
|
- (void)handlePopToWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
158
162
|
UIViewController *vc = [self findViewControllerWithNavigationController:nav extras:extras];
|
|
159
163
|
if (!vc) {
|
|
164
|
+
RCTLogInfo(@"[Navigation] 找不到要 popTo 的页面 %@", extras[@"moduleName"]);
|
|
160
165
|
callback(@[NSNull.null, @NO]);
|
|
161
166
|
return;
|
|
162
167
|
}
|
|
@@ -238,13 +243,9 @@
|
|
|
238
243
|
}
|
|
239
244
|
|
|
240
245
|
- (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
246
|
UIViewController *vc = [self viewControllerWithExtras:extras];
|
|
247
247
|
if (!vc) {
|
|
248
|
+
RCTLogInfo(@"[Navigation] 无法创建对应的页面 %@", extras[@"moduleName"]);
|
|
248
249
|
callback(@[NSNull.null, @NO]);
|
|
249
250
|
return;
|
|
250
251
|
}
|
|
@@ -270,6 +271,7 @@
|
|
|
270
271
|
NSDictionary *layout = extras[@"layout"];
|
|
271
272
|
UIViewController *vc = [[HBDReactBridgeManager get] viewControllerWithLayout:layout];
|
|
272
273
|
if (!vc) {
|
|
274
|
+
RCTLogInfo(@"[Navigation] 无法创建对应的 vc");
|
|
273
275
|
callback(@[NSNull.null, @NO]);
|
|
274
276
|
return;
|
|
275
277
|
}
|
|
@@ -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(@"销毁页面 %@", 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(@"加载页面 %@", 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,7 +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
19
|
@property(nonatomic, assign) BOOL hbd_inViewHierarchy;
|
|
21
20
|
|
|
22
21
|
- (void)hbd_setNeedsUpdateNavigationBar;
|
|
@@ -15,8 +15,6 @@
|
|
|
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
18
|
hbd_exchangeImplementations(clazz, @selector(didMoveToParentViewController:), @selector(hbd_didMoveToParentViewController:));
|
|
21
19
|
});
|
|
22
20
|
}
|
|
@@ -26,16 +24,6 @@
|
|
|
26
24
|
self.hbd_inViewHierarchy = parent != nil;
|
|
27
25
|
}
|
|
28
26
|
|
|
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
27
|
- (void)hbd_presentViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(void (^)(void))completion {
|
|
40
28
|
if (![self canPresentViewController]) {
|
|
41
29
|
[self didReceiveResultCode:0 resultData:nil requestCode:viewController.requestCode];
|
|
@@ -51,7 +39,7 @@
|
|
|
51
39
|
- (BOOL)canPresentViewController {
|
|
52
40
|
UIViewController *presented = self.presentedViewController;
|
|
53
41
|
if (presented && !presented.isBeingDismissed) {
|
|
54
|
-
|
|
42
|
+
RCTLogInfo(@"[Navigation] Can't present since the scene had present another scene already.");
|
|
55
43
|
return NO;
|
|
56
44
|
}
|
|
57
45
|
return YES;
|
|
@@ -258,14 +246,6 @@
|
|
|
258
246
|
objc_setAssociatedObject(self, @selector(hbd_swipeBackEnabled), @(enabled), OBJC_ASSOCIATION_COPY_NONATOMIC);
|
|
259
247
|
}
|
|
260
248
|
|
|
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
249
|
|
|
270
250
|
- (BOOL)hbd_inViewHierarchy {
|
|
271
251
|
id obj = objc_getAssociatedObject(self, _cmd);
|
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.11",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
7
7
|
"react-native": "src/index",
|