hybrid-navigation 2.7.11 → 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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.8.0 (2022-04-13)
2
+
3
+ - 添加 `forceTransparentDialogWindow` 配置项,用于设置当页面是 Dialog 时,是否强制背景透明
4
+
1
5
  ## 2.7.11 (2022-04-13)
2
6
 
3
7
  ### Android specific
@@ -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.8'
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() {
@@ -208,7 +208,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
208
208
  } else {
209
209
  promise.resolve(null);
210
210
  }
211
- }, true);
211
+ });
212
212
  }
213
213
  };
214
214
 
@@ -268,7 +268,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
268
268
  } else {
269
269
  UiThreadUtil.runOnUiThread(this, 16);
270
270
  }
271
- }, true);
271
+ });
272
272
  }
273
273
  };
274
274
 
@@ -300,7 +300,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
300
300
  } else {
301
301
  UiThreadUtil.runOnUiThread(this, 16);
302
302
  }
303
- }, true);
303
+ });
304
304
  }
305
305
  };
306
306
 
@@ -20,6 +20,8 @@
20
20
 
21
21
  // ------
22
22
 
23
+ @property(nonatomic, assign) BOOL forceTransparentDialogWindow;
24
+
23
25
  - (instancetype)initWithViewController:(HBDViewController *)vc;
24
26
 
25
27
  - (void)setLeftBarButtonItem:(NSDictionary *)item;
@@ -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/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.7.11",
4
+ "version": "2.8.0",
5
5
  "keywords": [
6
6
  "react-native",
7
7
  "navigation",