hybrid-navigation 2.7.9 → 2.8.0
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/CHANGELOG.md +14 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/Garden.java +4 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +6 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/NavigationModule.java +35 -28
- package/docs/qa.md +2 -0
- package/ios/HybridNavigation/HBDGarden.h +2 -0
- package/ios/HybridNavigation/ViewController/HBDModalViewController.m +6 -0
- package/ios/HybridNavigation/ViewController/HBDViewController.m +1 -1
- package/lib/ReactRegistry.d.ts +1 -1
- package/lib/typing.d.ts +1 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 2.8.0 (2022-04-13)
|
|
2
|
+
|
|
3
|
+
- 添加 `forceTransparentDialogWindow` 配置项,用于设置当页面是 Dialog 时,是否强制背景透明
|
|
4
|
+
|
|
5
|
+
## 2.7.11 (2022-04-13)
|
|
6
|
+
|
|
7
|
+
### Android specific
|
|
8
|
+
|
|
9
|
+
- 确保在 Activity 处于 start 状态时,才获取 `currentRoute` 和 `routeGraph`
|
|
10
|
+
|
|
11
|
+
## 2.7.10 (2022-04-12)
|
|
12
|
+
|
|
13
|
+
- 使用 `CompanentType<any>` 代替 `React.ComponentType<any>`
|
|
14
|
+
|
|
1
15
|
## 2.7.9 (2022-03-23)
|
|
2
16
|
|
|
3
17
|
### Android specific
|
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:12.0
|
|
36
|
+
api 'io.github.listenzz:AndroidNavigation:12.1.0'
|
|
37
37
|
}
|
|
@@ -62,6 +62,8 @@ public class Garden {
|
|
|
62
62
|
|
|
63
63
|
boolean extendedLayoutIncludesTopBar;
|
|
64
64
|
|
|
65
|
+
boolean forceTransparentDialogWindow;
|
|
66
|
+
|
|
65
67
|
Garden(@NonNull HybridFragment fragment, Style style) {
|
|
66
68
|
// 构造 garden 实例时,Toolbar 还没有被创建
|
|
67
69
|
|
|
@@ -81,6 +83,8 @@ public class Garden {
|
|
|
81
83
|
if (!TextUtils.isEmpty(screenColor)) {
|
|
82
84
|
style.setScreenBackgroundColor(Color.parseColor(screenColor));
|
|
83
85
|
}
|
|
86
|
+
|
|
87
|
+
this.forceTransparentDialogWindow = options.getBoolean("forceTransparentDialogWindow");
|
|
84
88
|
|
|
85
89
|
applyOptions(options);
|
|
86
90
|
}
|
|
@@ -2,6 +2,7 @@ package com.reactnative.hybridnavigation;
|
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle;
|
|
4
4
|
import android.view.View;
|
|
5
|
+
import android.view.Window;
|
|
5
6
|
|
|
6
7
|
import androidx.annotation.CallSuper;
|
|
7
8
|
import androidx.annotation.NonNull;
|
|
@@ -90,6 +91,11 @@ public class HybridFragment extends AwesomeFragment {
|
|
|
90
91
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
91
92
|
super.onViewCreated(view, savedInstanceState);
|
|
92
93
|
garden.configureToolbar();
|
|
94
|
+
if (getShowsDialog() && garden.forceTransparentDialogWindow) {
|
|
95
|
+
Window window = getWindow();
|
|
96
|
+
assert window != null;
|
|
97
|
+
window.setDimAmount(0);
|
|
98
|
+
}
|
|
93
99
|
}
|
|
94
100
|
|
|
95
101
|
public Garden getGarden() {
|
|
@@ -198,17 +198,20 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
ReactAppCompatActivity reactAppCompatActivity = (ReactAppCompatActivity) activity;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
201
|
+
reactAppCompatActivity.scheduleTaskAtStarted(() -> {
|
|
202
|
+
FragmentManager fragmentManager = reactAppCompatActivity.getSupportFragmentManager();
|
|
203
|
+
Fragment fragment = fragmentManager.findFragmentById(android.R.id.content);
|
|
204
|
+
if (fragment instanceof AwesomeFragment) {
|
|
205
|
+
String sceneId = findSceneIdByModuleName(moduleName, (AwesomeFragment) fragment);
|
|
206
|
+
FLog.i(TAG, "The sceneId found by " + moduleName + " : " + sceneId);
|
|
207
|
+
promise.resolve(sceneId);
|
|
208
|
+
} else {
|
|
209
|
+
promise.resolve(null);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
210
212
|
}
|
|
211
213
|
};
|
|
214
|
+
|
|
212
215
|
UiThreadUtil.runOnUiThread(task);
|
|
213
216
|
}
|
|
214
217
|
|
|
@@ -252,18 +255,20 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
|
|
252
255
|
}
|
|
253
256
|
|
|
254
257
|
ReactAppCompatActivity reactAppCompatActivity = (ReactAppCompatActivity) activity;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
258
|
+
reactAppCompatActivity.scheduleTaskAtStarted(() -> {
|
|
259
|
+
FragmentManager fragmentManager = reactAppCompatActivity.getSupportFragmentManager();
|
|
260
|
+
HybridFragment current = bridgeManager.primaryFragment(fragmentManager);
|
|
261
|
+
|
|
262
|
+
if (current != null) {
|
|
263
|
+
Bundle bundle = new Bundle();
|
|
264
|
+
bundle.putString("moduleName", current.getModuleName());
|
|
265
|
+
bundle.putString("sceneId", current.getSceneId());
|
|
266
|
+
bundle.putString("mode", Navigator.Util.getMode(current));
|
|
267
|
+
promise.resolve(Arguments.fromBundle(bundle));
|
|
268
|
+
} else {
|
|
269
|
+
UiThreadUtil.runOnUiThread(this, 16);
|
|
270
|
+
}
|
|
271
|
+
});
|
|
267
272
|
}
|
|
268
273
|
};
|
|
269
274
|
|
|
@@ -287,13 +292,15 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
|
|
287
292
|
}
|
|
288
293
|
|
|
289
294
|
ReactAppCompatActivity reactAppCompatActivity = (ReactAppCompatActivity) activity;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
reactAppCompatActivity.scheduleTaskAtStarted(() -> {
|
|
296
|
+
FragmentManager fragmentManager = reactAppCompatActivity.getSupportFragmentManager();
|
|
297
|
+
ArrayList<Bundle> graph = bridgeManager.buildRouteGraph(fragmentManager);
|
|
298
|
+
if (graph.size() > 0) {
|
|
299
|
+
promise.resolve(Arguments.fromList(graph));
|
|
300
|
+
} else {
|
|
301
|
+
UiThreadUtil.runOnUiThread(this, 16);
|
|
302
|
+
}
|
|
303
|
+
});
|
|
297
304
|
}
|
|
298
305
|
};
|
|
299
306
|
|
package/docs/qa.md
CHANGED
|
@@ -448,6 +448,12 @@
|
|
|
448
448
|
|
|
449
449
|
HBDModalViewController *modalViewController = [[HBDModalViewController alloc] init];
|
|
450
450
|
modalViewController.contentViewController = vc;
|
|
451
|
+
if ([vc isKindOfClass:[HBDViewController class]]) {
|
|
452
|
+
HBDViewController *hbdvc = (HBDViewController *)vc;
|
|
453
|
+
if (hbdvc.garden.forceTransparentDialogWindow) {
|
|
454
|
+
modalViewController.dimmingView.backgroundColor = UIColor.clearColor;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
451
457
|
[modalViewController showWithAnimated:animated completion:completion];
|
|
452
458
|
}
|
|
453
459
|
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
_options = options;
|
|
38
38
|
_props = props;
|
|
39
39
|
_garden = [[HBDGarden alloc] initWithViewController:self];
|
|
40
|
-
|
|
40
|
+
_garden.forceTransparentDialogWindow = [options[@"forceTransparentDialogWindow"] boolValue];
|
|
41
41
|
[self applyNavigationBarOptions:options];
|
|
42
42
|
[self applyTabBarOptions:options];
|
|
43
43
|
}
|
package/lib/ReactRegistry.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface InjectedProps {
|
|
|
10
10
|
sceneId: string;
|
|
11
11
|
}
|
|
12
12
|
export declare const NavigationContext: React.Context<any>;
|
|
13
|
-
export declare type HOC = (WrappedComponent:
|
|
13
|
+
export declare type HOC = (WrappedComponent: ComponentType<any>) => ComponentType<any>;
|
|
14
14
|
export declare class ReactRegistry {
|
|
15
15
|
static registerEnded: boolean;
|
|
16
16
|
static startRegisterComponent(hoc?: HOC): void;
|
package/lib/typing.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export interface NavigationOption {
|
|
|
58
58
|
}
|
|
59
59
|
export interface NavigationItem extends NavigationOption {
|
|
60
60
|
screenBackgroundColor?: Color;
|
|
61
|
+
forceTransparentDialogWindow?: boolean;
|
|
61
62
|
topBarHidden?: boolean;
|
|
62
63
|
extendedLayoutIncludesTopBar?: boolean;
|
|
63
64
|
swipeBackEnabled?: boolean;
|
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.
|
|
4
|
+
"version": "2.8.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
7
7
|
"navigation",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"jest": "^27.2.0",
|
|
55
55
|
"metro-react-native-babel-preset": "^0.68.0",
|
|
56
56
|
"react": "17.0.2",
|
|
57
|
-
"react-native": "^0.67.
|
|
57
|
+
"react-native": "^0.67.4",
|
|
58
58
|
"react-native-fast-image": "^8.5.11",
|
|
59
59
|
"react-native-iphone-x-helper": "^1.2.0",
|
|
60
60
|
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
"react-test-renderer": "17.0.2",
|
|
64
64
|
"redux": "^4.1.1",
|
|
65
65
|
"typescript": "^4.4.3",
|
|
66
|
-
"vuepress": "^2.0.0-beta.26"
|
|
66
|
+
"vuepress": "^2.0.0-beta.26",
|
|
67
|
+
"zustand": "^3.7.1"
|
|
67
68
|
},
|
|
68
69
|
"jest": {
|
|
69
70
|
"preset": "react-native",
|