hybrid-navigation 2.5.1 → 2.6.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
|
@@ -2,6 +2,7 @@ package com.reactnative.hybridnavigation;
|
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
import android.graphics.Color;
|
|
5
|
+
import android.graphics.drawable.ColorDrawable;
|
|
5
6
|
import android.os.Bundle;
|
|
6
7
|
import android.text.TextUtils;
|
|
7
8
|
import android.view.View;
|
|
@@ -107,6 +108,7 @@ public class Garden {
|
|
|
107
108
|
} else if (rightBarButtonItem != null) {
|
|
108
109
|
setRightBarButtonItem(rightBarButtonItem);
|
|
109
110
|
}
|
|
111
|
+
|
|
110
112
|
Bundle leftBarButtonItem = options.getBundle("leftBarButtonItem");
|
|
111
113
|
ArrayList<Bundle> leftBarButtonItems = options.getParcelableArrayList("leftBarButtonItems");
|
|
112
114
|
if (leftBarButtonItems != null) {
|
|
@@ -265,6 +267,15 @@ public class Garden {
|
|
|
265
267
|
|
|
266
268
|
applyOptions(patches);
|
|
267
269
|
|
|
270
|
+
if (readableMap.hasKey("screenBackgroundColor")) {
|
|
271
|
+
String color = readableMap.getString("screenBackgroundColor");
|
|
272
|
+
style.setScreenBackgroundColor(Color.parseColor(color));
|
|
273
|
+
View root = fragment.getView();
|
|
274
|
+
if (root != null) {
|
|
275
|
+
root.setBackground(new ColorDrawable(Color.parseColor(color)));
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
268
279
|
if (shouldUpdateStatusBar(readableMap)) {
|
|
269
280
|
fragment.setNeedsStatusBarAppearanceUpdate();
|
|
270
281
|
}
|
|
@@ -281,7 +292,7 @@ public class Garden {
|
|
|
281
292
|
boolean passThroughTouches = readableMap.getBoolean("passThroughTouches");
|
|
282
293
|
setPassThroughTouches(passThroughTouches);
|
|
283
294
|
}
|
|
284
|
-
|
|
295
|
+
|
|
285
296
|
Bundle options = mergeOptions(fragment.getOptions(), patches);
|
|
286
297
|
|
|
287
298
|
if (readableMap.hasKey("leftBarButtonItem")) {
|
|
@@ -338,7 +349,7 @@ public class Garden {
|
|
|
338
349
|
}
|
|
339
350
|
|
|
340
351
|
private boolean shouldUpdateNavigationBar(@NonNull ReadableMap readableMap) {
|
|
341
|
-
String[] keys = new String[]{"navigationBarColorAndroid", "navigationBarHiddenAndroid"};
|
|
352
|
+
String[] keys = new String[]{"navigationBarColorAndroid", "navigationBarHiddenAndroid", "screenBackgroundColor"};
|
|
342
353
|
for (String key : keys) {
|
|
343
354
|
if (readableMap.hasKey(key)) {
|
|
344
355
|
return true;
|
package/docs/qa.md
CHANGED
|
@@ -36,3 +36,20 @@ module.exports = {
|
|
|
36
36
|
},
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
|
+
|
|
40
|
+
## 如何拦截 Android 物理返回键
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
useVisibleEffect(
|
|
44
|
+
useCallback(() => {
|
|
45
|
+
const handleBackPress = () => {
|
|
46
|
+
console.log('---------------')
|
|
47
|
+
// true 表示拦截,false 表示不拦截
|
|
48
|
+
return false
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
BackHandler.addEventListener('hardwareBackPress', handleBackPress)
|
|
52
|
+
return () => BackHandler.removeEventListener('hardwareBackPress', handleBackPress)
|
|
53
|
+
}, []),
|
|
54
|
+
)
|
|
55
|
+
```
|
|
@@ -285,6 +285,11 @@
|
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
[self applyNavigationBarOptions:target];
|
|
288
|
+
|
|
289
|
+
NSString *screenColor = options[@"screenBackgroundColor"];
|
|
290
|
+
if (screenColor && [self isViewLoaded]) {
|
|
291
|
+
self.view.backgroundColor = [HBDUtils colorWithHexString:screenColor];
|
|
292
|
+
}
|
|
288
293
|
|
|
289
294
|
NSNumber *statusBarHidden = [options objectForKey:@"statusBarHidden"];
|
|
290
295
|
if (statusBarHidden) {
|
package/lib/typing.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare const LayoutFittingCompressed = "compressed";
|
|
|
38
38
|
export declare type LayoutFittingCompressed = typeof LayoutFittingCompressed;
|
|
39
39
|
export declare type LayoutFitting = LayoutFittingExpanded | LayoutFittingCompressed;
|
|
40
40
|
export interface NavigationOption {
|
|
41
|
+
screenBackgroundColor?: Color;
|
|
41
42
|
passThroughTouches?: boolean;
|
|
42
43
|
statusBarHidden?: boolean;
|
|
43
44
|
statusBarColorAndroid?: Color;
|