hybrid-navigation 2.18.2 → 2.18.4
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/LICENSE +1 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/NavigationModule.java +1 -0
- package/{lib → dist}/Navigation.d.ts +1 -1
- package/{lib → dist}/Navigation.js +10 -4
- package/{lib → dist}/NavigationComponentWrap.js +6 -5
- package/{lib → dist}/NavigationModule.d.ts +1 -0
- package/{lib → dist}/Navigator.d.ts +0 -1
- package/{lib → dist}/Navigator.js +22 -11
- package/{lib → dist}/hooks.js +2 -1
- package/{lib → dist}/index.d.ts +1 -1
- package/{lib → dist}/index.js +1 -1
- package/{lib → dist}/router/index.js +6 -2
- package/{lib → dist}/router/stack.js +1 -1
- package/ios/HybridNavigation/HBDUtils.h +2 -0
- package/ios/HybridNavigation/HBDUtils.m +12 -3
- package/ios/HybridNavigation/ReactBridge/HBDGardenModule.m +2 -6
- package/ios/HybridNavigation/ReactBridge/HBDNavigationModule.m +13 -13
- package/ios/HybridNavigation/ReactBridge/HBDReactBridgeManager.h +1 -0
- package/ios/HybridNavigation/ReactBridge/HBDReactBridgeManager.m +1 -0
- package/ios/HybridNavigation/ViewController/HBDDrawerController.m +1 -1
- package/ios/HybridNavigation/ViewController/HBDNavigationController.m +1 -1
- package/ios/HybridNavigation/ViewController/HBDViewController.m +1 -1
- package/package.json +47 -78
- package/src/DeepLink.ts +52 -52
- package/src/Event.ts +88 -83
- package/src/GardenModule.ts +30 -30
- package/src/Navigation.ts +293 -274
- package/src/NavigationComponentWrap.tsx +52 -47
- package/src/NavigationModule.ts +77 -76
- package/src/Navigator.ts +212 -201
- package/src/Options.ts +120 -112
- package/src/Route.ts +59 -59
- package/src/handler/BarButtonEventHandler.ts +50 -46
- package/src/handler/DispatchCommandHandler.ts +56 -52
- package/src/handler/LayoutCommandHandler.ts +21 -21
- package/src/handler/ResultEventHandler.ts +63 -49
- package/src/handler/VisibilityEventHandler.ts +57 -40
- package/src/hooks.ts +23 -21
- package/src/index.ts +15 -15
- package/src/router/drawer.ts +24 -24
- package/src/router/index.ts +206 -198
- package/src/router/screen.ts +28 -28
- package/src/router/stack.ts +76 -76
- package/src/router/tabs.ts +28 -28
- package/src/store.ts +9 -9
- package/README.md +0 -79
- /package/{lib → dist}/DeepLink.d.ts +0 -0
- /package/{lib → dist}/DeepLink.js +0 -0
- /package/{lib → dist}/Event.d.ts +0 -0
- /package/{lib → dist}/Event.js +0 -0
- /package/{lib → dist}/GardenModule.d.ts +0 -0
- /package/{lib → dist}/GardenModule.js +0 -0
- /package/{lib → dist}/NavigationComponentWrap.d.ts +0 -0
- /package/{lib → dist}/NavigationModule.js +0 -0
- /package/{lib → dist}/Options.d.ts +0 -0
- /package/{lib → dist}/Options.js +0 -0
- /package/{lib → dist}/Route.d.ts +0 -0
- /package/{lib → dist}/Route.js +0 -0
- /package/{lib → dist}/handler/BarButtonEventHandler.d.ts +0 -0
- /package/{lib → dist}/handler/BarButtonEventHandler.js +0 -0
- /package/{lib → dist}/handler/DispatchCommandHandler.d.ts +0 -0
- /package/{lib → dist}/handler/DispatchCommandHandler.js +0 -0
- /package/{lib → dist}/handler/LayoutCommandHandler.d.ts +0 -0
- /package/{lib → dist}/handler/LayoutCommandHandler.js +0 -0
- /package/{lib → dist}/handler/ResultEventHandler.d.ts +0 -0
- /package/{lib → dist}/handler/ResultEventHandler.js +0 -0
- /package/{lib → dist}/handler/VisibilityEventHandler.d.ts +0 -0
- /package/{lib → dist}/handler/VisibilityEventHandler.js +0 -0
- /package/{lib → dist}/hooks.d.ts +0 -0
- /package/{lib → dist}/router/drawer.d.ts +0 -0
- /package/{lib → dist}/router/drawer.js +0 -0
- /package/{lib → dist}/router/index.d.ts +0 -0
- /package/{lib → dist}/router/screen.d.ts +0 -0
- /package/{lib → dist}/router/screen.js +0 -0
- /package/{lib → dist}/router/stack.d.ts +0 -0
- /package/{lib → dist}/router/tabs.d.ts +0 -0
- /package/{lib → dist}/router/tabs.js +0 -0
- /package/{lib → dist}/store.d.ts +0 -0
- /package/{lib → dist}/store.js +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 listen <listenzz@163.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -66,6 +66,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
|
|
66
66
|
HashMap<String, Object> constants = new HashMap<>();
|
|
67
67
|
constants.put("RESULT_OK", Activity.RESULT_OK);
|
|
68
68
|
constants.put("RESULT_CANCEL", Activity.RESULT_CANCELED);
|
|
69
|
+
constants.put("RESULT_BLOCK", -2);
|
|
69
70
|
return constants;
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -11,7 +11,7 @@ type BarButtonClickEventListener = (sceneId: string, value: Function) => void;
|
|
|
11
11
|
type Nullable<T> = {
|
|
12
12
|
[P in keyof T]: T[P] extends T[P] | undefined ? T[P] | null : T[P];
|
|
13
13
|
};
|
|
14
|
-
export declare const RESULT_CANCEL: number, RESULT_OK: number;
|
|
14
|
+
export declare const RESULT_CANCEL: number, RESULT_OK: number, RESULT_BLOCK: number;
|
|
15
15
|
export type NavigationSubscription = {
|
|
16
16
|
remove: () => void;
|
|
17
17
|
};
|
|
@@ -7,7 +7,7 @@ import VisibilityEventHandler from './handler/VisibilityEventHandler';
|
|
|
7
7
|
import Event from './Event';
|
|
8
8
|
import GardenModule from './GardenModule';
|
|
9
9
|
import NavigationModule from './NavigationModule';
|
|
10
|
-
export const { RESULT_CANCEL, RESULT_OK } = NavigationModule.getConstants();
|
|
10
|
+
export const { RESULT_CANCEL, RESULT_OK, RESULT_BLOCK } = NavigationModule.getConstants();
|
|
11
11
|
class NavigationImpl {
|
|
12
12
|
dispatchHandler = new DispatchCommandHandler();
|
|
13
13
|
resultHandler = new ResultEventHandler();
|
|
@@ -30,7 +30,7 @@ class NavigationImpl {
|
|
|
30
30
|
}
|
|
31
31
|
endRegisterComponent() {
|
|
32
32
|
if (this.registerEnded) {
|
|
33
|
-
console.warn(
|
|
33
|
+
console.warn("Please don't call ReactRegistry#endRegisterComponent multiple times.");
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
this.registerEnded = true;
|
|
@@ -45,7 +45,8 @@ class NavigationImpl {
|
|
|
45
45
|
WrappedComponent = this.hoc(WrappedComponent);
|
|
46
46
|
}
|
|
47
47
|
// build static options
|
|
48
|
-
let options = this.bindBarButtonClickEvent('permanent', WrappedComponent.navigationItem) ||
|
|
48
|
+
let options = this.bindBarButtonClickEvent('permanent', WrappedComponent.navigationItem) ||
|
|
49
|
+
{};
|
|
49
50
|
NavigationModule.registerReactComponent(appKey, options);
|
|
50
51
|
let RootComponent = this.wrap(appKey)(WrappedComponent);
|
|
51
52
|
AppRegistry.registerComponent(appKey, () => RootComponent);
|
|
@@ -83,7 +84,12 @@ class NavigationImpl {
|
|
|
83
84
|
setInterceptor(interceptor) {
|
|
84
85
|
this.dispatchHandler.setInterceptor(interceptor);
|
|
85
86
|
}
|
|
86
|
-
setResult = (sceneId, resultCode, data = null) =>
|
|
87
|
+
setResult = (sceneId, resultCode, data = null) => {
|
|
88
|
+
if (resultCode < RESULT_OK) {
|
|
89
|
+
console.warn('`resultCode` can only be `RESULT_OK`, `RESULT_CANCEL` or an integer greater than 0.');
|
|
90
|
+
}
|
|
91
|
+
NavigationModule.setResult(sceneId, resultCode, data);
|
|
92
|
+
};
|
|
87
93
|
result(sceneId, resultCode) {
|
|
88
94
|
return this.resultHandler.waitResult(sceneId, resultCode);
|
|
89
95
|
}
|
|
@@ -22,8 +22,8 @@ export function withNavigation(moduleName) {
|
|
|
22
22
|
navigator,
|
|
23
23
|
};
|
|
24
24
|
return (<NavigationContext.Provider value={navigator}>
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
<WrappedComponent ref={ref} {...props} {...injected}/>
|
|
26
|
+
</NavigationContext.Provider>);
|
|
27
27
|
});
|
|
28
28
|
FC.displayName = `withNavigation(${getDisplayName(WrappedComponent)})`;
|
|
29
29
|
return FC;
|
|
@@ -33,11 +33,12 @@ export function withNavigationItem(item) {
|
|
|
33
33
|
return function (WrappedComponent) {
|
|
34
34
|
let navigationItem = WrappedComponent.navigationItem;
|
|
35
35
|
if (navigationItem) {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
WrappedComponent.navigationItem = {
|
|
37
|
+
...navigationItem,
|
|
38
|
+
...item,
|
|
39
|
+
};
|
|
38
40
|
}
|
|
39
41
|
else {
|
|
40
|
-
;
|
|
41
42
|
WrappedComponent.navigationItem = item;
|
|
42
43
|
}
|
|
43
44
|
return WrappedComponent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
import store from './store';
|
|
3
|
-
import Navigation, {
|
|
3
|
+
import Navigation, { RESULT_BLOCK } from './Navigation';
|
|
4
4
|
export const NavigationContext = createContext(null);
|
|
5
5
|
let tagGenerator = 0;
|
|
6
6
|
Navigation.addGlobalVisibilityEventListener((sceneId, visibility) => {
|
|
@@ -13,7 +13,7 @@ Navigation.setBarButtonClickEventListener((sceneId, value) => {
|
|
|
13
13
|
const navigator = Navigator.of(sceneId);
|
|
14
14
|
value(navigator);
|
|
15
15
|
});
|
|
16
|
-
|
|
16
|
+
class Navigator {
|
|
17
17
|
sceneId;
|
|
18
18
|
moduleName;
|
|
19
19
|
static of(sceneId) {
|
|
@@ -58,7 +58,7 @@ export class Navigator {
|
|
|
58
58
|
options,
|
|
59
59
|
});
|
|
60
60
|
if (!success) {
|
|
61
|
-
return [
|
|
61
|
+
return [RESULT_BLOCK, null];
|
|
62
62
|
}
|
|
63
63
|
return Navigation.result(this.sceneId, 0);
|
|
64
64
|
};
|
|
@@ -68,12 +68,16 @@ export class Navigator {
|
|
|
68
68
|
layout,
|
|
69
69
|
});
|
|
70
70
|
if (!success) {
|
|
71
|
-
return [
|
|
71
|
+
return [RESULT_BLOCK, null];
|
|
72
72
|
}
|
|
73
73
|
return Navigation.result(this.sceneId, 0);
|
|
74
74
|
};
|
|
75
75
|
pop = () => Navigation.dispatch(this.sceneId, 'pop', { from: this.moduleName });
|
|
76
|
-
popTo = (moduleName, inclusive = false) => Navigation.dispatch(this.sceneId, 'popTo', {
|
|
76
|
+
popTo = (moduleName, inclusive = false) => Navigation.dispatch(this.sceneId, 'popTo', {
|
|
77
|
+
moduleName,
|
|
78
|
+
inclusive,
|
|
79
|
+
from: this.moduleName,
|
|
80
|
+
});
|
|
77
81
|
popToRoot = () => Navigation.dispatch(this.sceneId, 'popToRoot', { from: this.moduleName });
|
|
78
82
|
redirectTo = (moduleName, props = {}, options = {}) => Navigation.dispatch(this.sceneId, 'redirectTo', {
|
|
79
83
|
moduleName,
|
|
@@ -94,7 +98,7 @@ export class Navigator {
|
|
|
94
98
|
});
|
|
95
99
|
if (!success) {
|
|
96
100
|
console.warn(`present from:${this.moduleName} to:${moduleName} failed. Maybe the screen (${this.moduleName}) already shows or present another screen.`);
|
|
97
|
-
return [
|
|
101
|
+
return [RESULT_BLOCK, null];
|
|
98
102
|
}
|
|
99
103
|
return Navigation.result(this.sceneId, requestCode);
|
|
100
104
|
};
|
|
@@ -107,7 +111,7 @@ export class Navigator {
|
|
|
107
111
|
});
|
|
108
112
|
if (!success) {
|
|
109
113
|
console.warn(`presentLayout from:${this.moduleName} failed. Maybe the screen (${this.moduleName}) already shows or present another screen.`);
|
|
110
|
-
return [
|
|
114
|
+
return [RESULT_BLOCK, null];
|
|
111
115
|
}
|
|
112
116
|
return Navigation.result(this.sceneId, requestCode);
|
|
113
117
|
};
|
|
@@ -124,7 +128,7 @@ export class Navigator {
|
|
|
124
128
|
});
|
|
125
129
|
if (!success) {
|
|
126
130
|
console.warn(`showModal from:${this.moduleName} to:${moduleName} failed. Maybe the screen (${this.moduleName}) already shows or present another screen.`);
|
|
127
|
-
return [
|
|
131
|
+
return [RESULT_BLOCK, null];
|
|
128
132
|
}
|
|
129
133
|
return Navigation.result(this.sceneId, requestCode);
|
|
130
134
|
};
|
|
@@ -137,7 +141,7 @@ export class Navigator {
|
|
|
137
141
|
});
|
|
138
142
|
if (!success) {
|
|
139
143
|
console.warn(`showModal from:${this.moduleName} failed. Maybe the screen (${this.moduleName}) already shows or present another screen.`);
|
|
140
|
-
return [
|
|
144
|
+
return [RESULT_BLOCK, null];
|
|
141
145
|
}
|
|
142
146
|
return Navigation.result(this.sceneId, requestCode);
|
|
143
147
|
};
|
|
@@ -145,10 +149,17 @@ export class Navigator {
|
|
|
145
149
|
setResult = (resultCode, data = null) => Navigation.setResult(this.sceneId, resultCode, data);
|
|
146
150
|
switchTab = async (index, popToRoot = false) => {
|
|
147
151
|
const from = await Navigation.currentTab(this.sceneId);
|
|
148
|
-
return Navigation.dispatch(this.sceneId, 'switchTab', {
|
|
152
|
+
return Navigation.dispatch(this.sceneId, 'switchTab', {
|
|
153
|
+
from,
|
|
154
|
+
to: index,
|
|
155
|
+
popToRoot,
|
|
156
|
+
});
|
|
149
157
|
};
|
|
150
|
-
toggleMenu = () => Navigation.dispatch(this.sceneId, 'toggleMenu', {
|
|
158
|
+
toggleMenu = () => Navigation.dispatch(this.sceneId, 'toggleMenu', {
|
|
159
|
+
from: this.moduleName,
|
|
160
|
+
});
|
|
151
161
|
openMenu = () => Navigation.dispatch(this.sceneId, 'openMenu', { from: this.moduleName });
|
|
152
162
|
closeMenu = () => Navigation.dispatch(this.sceneId, 'closeMenu', { from: this.moduleName });
|
|
153
163
|
isStackRoot = () => Navigation.isStackRoot(this.sceneId);
|
|
154
164
|
}
|
|
165
|
+
export { Navigator };
|
package/{lib → dist}/hooks.js
RENAMED
|
@@ -22,8 +22,9 @@ export function useVisible() {
|
|
|
22
22
|
export function useVisibleEffect(effect) {
|
|
23
23
|
const visible = useVisible();
|
|
24
24
|
useEffect(() => {
|
|
25
|
-
if (!visible)
|
|
25
|
+
if (!visible) {
|
|
26
26
|
return;
|
|
27
|
+
}
|
|
27
28
|
const destructor = effect();
|
|
28
29
|
return () => destructor && destructor();
|
|
29
30
|
}, [effect, visible]);
|
package/{lib → dist}/index.d.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const Navigation: import("./Navigation").Navigation;
|
|
2
2
|
export default Navigation;
|
|
3
|
-
export { RESULT_OK, RESULT_CANCEL } from './Navigation';
|
|
3
|
+
export { RESULT_OK, RESULT_CANCEL, RESULT_BLOCK } from './Navigation';
|
|
4
4
|
export { statusBarHeight, toolbarHeight, topBarHeight } from './GardenModule';
|
|
5
5
|
export { withNavigationItem } from './NavigationComponentWrap';
|
|
6
6
|
export type { NavigationProps } from './NavigationComponentWrap';
|
package/{lib → dist}/index.js
RENAMED
|
@@ -3,7 +3,7 @@ import navigation from './Navigation';
|
|
|
3
3
|
navigation.setNavigationComponentWrap(withNavigation);
|
|
4
4
|
const Navigation = navigation;
|
|
5
5
|
export default Navigation;
|
|
6
|
-
export { RESULT_OK, RESULT_CANCEL } from './Navigation';
|
|
6
|
+
export { RESULT_OK, RESULT_CANCEL, RESULT_BLOCK } from './Navigation';
|
|
7
7
|
export { statusBarHeight, toolbarHeight, topBarHeight } from './GardenModule';
|
|
8
8
|
export { withNavigationItem } from './NavigationComponentWrap';
|
|
9
9
|
export * from './Navigator';
|
|
@@ -134,10 +134,14 @@ class Router {
|
|
|
134
134
|
const { mode: layoutMode } = graphArray[index];
|
|
135
135
|
const { sceneId, moduleName } = await Navigation.currentRoute();
|
|
136
136
|
if (layoutMode === 'present') {
|
|
137
|
-
await Navigation.dispatch(sceneId, 'dismiss', {
|
|
137
|
+
await Navigation.dispatch(sceneId, 'dismiss', {
|
|
138
|
+
from: moduleName,
|
|
139
|
+
});
|
|
138
140
|
}
|
|
139
141
|
else if (layoutMode === 'modal') {
|
|
140
|
-
await Navigation.dispatch(sceneId, 'hideModal', {
|
|
142
|
+
await Navigation.dispatch(sceneId, 'hideModal', {
|
|
143
|
+
from: moduleName,
|
|
144
|
+
});
|
|
141
145
|
}
|
|
142
146
|
else {
|
|
143
147
|
console.warn('尚未处理的 layout mode:' + layoutMode);
|
|
@@ -30,7 +30,7 @@ export class StackRouteHandler {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
navigateTo(childGraph, target) {
|
|
33
|
-
const {
|
|
33
|
+
const { moduleName, dependencies, props } = target;
|
|
34
34
|
const expectations = [...dependencies, moduleName];
|
|
35
35
|
const index = expectations.findIndex(name => name === childGraph.moduleName);
|
|
36
36
|
const pendings = expectations.slice(index + 1);
|
|
@@ -166,18 +166,27 @@
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
+ (BOOL)isIphoneX {
|
|
169
|
-
|
|
169
|
+
UIWindow *window = RCTKeyWindow();
|
|
170
|
+
return window.safeAreaInsets.bottom > 0.0;
|
|
170
171
|
}
|
|
171
172
|
|
|
172
173
|
+ (BOOL)isInCall {
|
|
173
174
|
if ([HBDUtils isIphoneX]) {
|
|
174
175
|
return NO;
|
|
175
176
|
} else {
|
|
176
|
-
|
|
177
|
-
return statusBarHeight == 40;
|
|
177
|
+
return [self statusBarHeight] == 40;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
+ (CGFloat)statusBarHeight {
|
|
182
|
+
if (@available(iOS 13.0, *)) {
|
|
183
|
+
UIStatusBarManager *statusBarManager = RCTKeyWindow().windowScene.statusBarManager;
|
|
184
|
+
return statusBarManager.statusBarFrame.size.height;
|
|
185
|
+
} else {
|
|
186
|
+
return [[UIApplication sharedApplication] statusBarFrame].size.height;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
181
190
|
+ (void)printViewHierarchy:(UIView *)view withPrefix:(NSString *)prefix {
|
|
182
191
|
NSString *viewName = [[[view classForCoder] description] stringByReplacingOccurrencesOfString:@"_" withString:@""];
|
|
183
192
|
NSLog(@"%@%@ %@", prefix, viewName, NSStringFromCGRect(view.frame));
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
#import "HBDReactBridgeManager.h"
|
|
4
4
|
#import "HBDTabBarController.h"
|
|
5
5
|
#import "GlobalStyle.h"
|
|
6
|
+
#import "HBDUtils.h"
|
|
6
7
|
|
|
7
8
|
#import <React/RCTLog.h>
|
|
8
9
|
|
|
@@ -51,12 +52,7 @@ RCT_EXPORT_MODULE(GardenModule)
|
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
- (CGFloat)currentStatusBarHeight {
|
|
54
|
-
|
|
55
|
-
UIStatusBarManager *statusBarManager = [UIApplication sharedApplication].keyWindow.windowScene.statusBarManager;
|
|
56
|
-
return statusBarManager.statusBarFrame.size.height;
|
|
57
|
-
} else {
|
|
58
|
-
return [[UIApplication sharedApplication] statusBarFrame].size.height;
|
|
59
|
-
}
|
|
55
|
+
return [HBDUtils statusBarHeight];
|
|
60
56
|
}
|
|
61
57
|
|
|
62
58
|
- (void)handleStatusBarFrameChange {
|
|
@@ -41,7 +41,8 @@ RCT_EXPORT_MODULE(NavigationModule)
|
|
|
41
41
|
- (NSDictionary *)constantsToExport {
|
|
42
42
|
return @{
|
|
43
43
|
@"RESULT_OK": @(ResultOK),
|
|
44
|
-
@"RESULT_CANCEL": @(ResultCancel)
|
|
44
|
+
@"RESULT_CANCEL": @(ResultCancel),
|
|
45
|
+
@"RESULT_BLOCK": @(ResultBlock)
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
48
|
|
|
@@ -158,17 +159,16 @@ RCT_EXPORT_METHOD(findSceneIdByModuleName:(NSString *)moduleName callback:(RCTRe
|
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
- (NSString *)findSceneIdByModuleName:(NSString *)moduleName {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
162
|
+
UIWindow *keyWindow = RCTKeyWindow();
|
|
163
|
+
if (keyWindow) {
|
|
164
|
+
NSString *sceneId = [self findSceneIdByModuleName:moduleName withViewController:keyWindow.rootViewController];
|
|
165
|
+
if (sceneId != nil) {
|
|
166
|
+
RCTLogInfo(@"[Navigation] The sceneId found by %@ : %@", moduleName, sceneId);
|
|
167
|
+
return sceneId;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
RCTLogInfo(@"[Navigation] KeyWindow NOT found.");
|
|
172
172
|
|
|
173
173
|
return nil;
|
|
174
174
|
}
|
|
@@ -181,7 +181,7 @@ RCT_EXPORT_METHOD(findSceneIdByModuleName:(NSString *)moduleName callback:(RCTRe
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
if (vc.presentedViewController && vc != vc.presentedViewController && !vc.presentedViewController.isBeingDismissed) {
|
|
185
185
|
NSString *sceneId = [self findSceneIdByModuleName:moduleName withViewController:vc.presentedViewController];
|
|
186
186
|
if (sceneId) {
|
|
187
187
|
return sceneId;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
NSString *const ReactModuleRegistryDidCompletedNotification = @"ReactModuleRegistryDidCompletedNotification";
|
|
11
11
|
const NSInteger ResultOK = -1;
|
|
12
12
|
const NSInteger ResultCancel = 0;
|
|
13
|
+
const NSInteger ResultBlock = -2;
|
|
13
14
|
|
|
14
15
|
@interface HBDReactBridgeManager ()
|
|
15
16
|
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
- (void)statusBarFrameWillChange:(NSNotification *)notification {
|
|
87
|
-
|
|
87
|
+
CGFloat statusBarHeight = [HBDUtils statusBarHeight];
|
|
88
88
|
if (UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation) && statusBarHeight != 0) {
|
|
89
89
|
if (self.menuOpened) {
|
|
90
90
|
[UIView animateWithDuration:0.35 animations:^{
|
|
@@ -422,7 +422,7 @@
|
|
|
422
422
|
|
|
423
423
|
// RCTLogInfo(@"[Navigation] safeAreaInsets:%@, additionalInsets:%@", NSStringFromUIEdgeInsets(safeAreaInsets), NSStringFromUIEdgeInsets(additionalInsets));
|
|
424
424
|
|
|
425
|
-
|
|
425
|
+
BOOL statusBarHidden = RCTKeyWindow().windowScene.statusBarManager.statusBarHidden;
|
|
426
426
|
|
|
427
427
|
if (statusBarHidden && safeAreaInsets.top == 0) {
|
|
428
428
|
self.additionalSafeAreaInsets = UIEdgeInsetsMake(20, additionalInsets.left, additionalInsets.bottom, additionalInsets.right);
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
} else {
|
|
78
78
|
UIView *statusBar = [[UIApplication sharedApplication] valueForKey:@"statusBarWindow"];
|
|
79
79
|
BOOL hidden = [self hbd_statusBarHidden] && ![HBDUtils isInCall];
|
|
80
|
-
|
|
80
|
+
CGFloat statusBarHeight = [HBDUtils statusBarHeight];
|
|
81
81
|
[UIView animateWithDuration:0.2 animations:^{
|
|
82
82
|
statusBar.transform = hidden ? CGAffineTransformTranslate(CGAffineTransformIdentity, 0, -statusBarHeight) : CGAffineTransformIdentity;
|
|
83
83
|
statusBar.alpha = hidden ? 0 : 1.0;
|
package/package.json
CHANGED
|
@@ -1,80 +1,49 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
"dependencies": {
|
|
51
|
-
"path-to-regexp": "^6.1.0"
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@babel/core": "^7.20.0",
|
|
55
|
-
"@babel/preset-env": "^7.20.0",
|
|
56
|
-
"@babel/runtime": "^7.20.0",
|
|
57
|
-
"@gfez/eslint-config-react-native": "^1.0.0",
|
|
58
|
-
"@react-native-community/hooks": "^2.8.0",
|
|
59
|
-
"@react-native-community/slider": "^4.4.2",
|
|
60
|
-
"@sdcx/keyboard-insets": "^0.5.0",
|
|
61
|
-
"@types/jest": "^29.2.1",
|
|
62
|
-
"@types/react": "^18.0.24",
|
|
63
|
-
"@types/react-redux": "^7.1.9",
|
|
64
|
-
"@types/react-test-renderer": "^18.0.0",
|
|
65
|
-
"babel-jest": "^29.2.1",
|
|
66
|
-
"jest": "^29.2.1",
|
|
67
|
-
"metro-react-native-babel-preset": "0.73.7",
|
|
68
|
-
"react": "18.2.0",
|
|
69
|
-
"react-native": "^0.71.3",
|
|
70
|
-
"react-native-fast-image": "^8.5.11",
|
|
71
|
-
"react-native-safe-area-context": "^4.7.1",
|
|
72
|
-
"react-native-toast-hybrid": "^2.5.0",
|
|
73
|
-
"react-redux": "^7.2.5",
|
|
74
|
-
"react-test-renderer": "18.2.0",
|
|
75
|
-
"redux": "^4.1.1",
|
|
76
|
-
"typescript": "^4.6.4",
|
|
77
|
-
"vuepress": "2.0.0-beta.51",
|
|
78
|
-
"zustand": "^3.7.1"
|
|
79
|
-
}
|
|
2
|
+
"name": "hybrid-navigation",
|
|
3
|
+
"description": "React Native Navigation that supports seamless navigation between Native and React.",
|
|
4
|
+
"version": "2.18.4",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"typings": "./dist/index.d.ts",
|
|
7
|
+
"react-native": "src/index",
|
|
8
|
+
"nativePackage": true,
|
|
9
|
+
"files": [
|
|
10
|
+
"src",
|
|
11
|
+
"dist",
|
|
12
|
+
"android",
|
|
13
|
+
"ios",
|
|
14
|
+
"HybridNavigation.podspec",
|
|
15
|
+
"!android/build",
|
|
16
|
+
"!android/.gradle",
|
|
17
|
+
"!android/.idea",
|
|
18
|
+
"!android/local.properties",
|
|
19
|
+
"!ios/build",
|
|
20
|
+
"!**/__tests__"
|
|
21
|
+
],
|
|
22
|
+
"repository": "https://github.com/listenzz/hybrid-navigation",
|
|
23
|
+
"homepage": "https://github.com/listenzz/hybrid-navigation#readme",
|
|
24
|
+
"author": "listen <listenzz@163.com> (https://github.com/listenzz)",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"licenseFilename": "LICENSE",
|
|
27
|
+
"keywords": [
|
|
28
|
+
"react-native",
|
|
29
|
+
"navigation",
|
|
30
|
+
"navigator",
|
|
31
|
+
"router",
|
|
32
|
+
"hybrid"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "rm -rf ./dist && tsc -p tsconfig.json",
|
|
36
|
+
"prepare": "npm run build",
|
|
37
|
+
"test": "jest",
|
|
38
|
+
"tsc": "tsc",
|
|
39
|
+
"lint": "eslint . --fix --ext .js,.jsx,.ts,.tsx"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"react": ">=16.8",
|
|
43
|
+
"react-native": ">=0.60"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"path-to-regexp": "^6.1.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {}
|
|
80
49
|
}
|