react-native-edge-to-edge 1.1.3 → 1.3.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.
Files changed (33) hide show
  1. package/README.md +75 -73
  2. package/android/src/main/java/com/zoontek/rnedgetoedge/EdgeToEdgeModuleImpl.kt +59 -15
  3. package/android/src/main/java/com/zoontek/rnedgetoedge/EdgeToEdgePackage.kt +9 -12
  4. package/android/src/main/res/values/attrs.xml +5 -0
  5. package/android/src/main/res/values/public.xml +6 -0
  6. package/android/src/main/res/values/styles.xml +52 -6
  7. package/android/src/main/res/values-v27/colors.xml +1 -2
  8. package/android/src/main/res/values-v27/styles.xml +18 -3
  9. package/android/src/main/res/values-v29/styles.xml +27 -6
  10. package/android/src/main/res/values-v30/styles.xml +27 -6
  11. package/dist/commonjs/SystemBars.js +18 -7
  12. package/dist/commonjs/SystemBars.js.map +1 -1
  13. package/dist/commonjs/expo.js +17 -4
  14. package/dist/commonjs/expo.js.map +1 -1
  15. package/dist/commonjs/specs/NativeEdgeToEdgeModule.js.map +1 -1
  16. package/dist/module/SystemBars.js +18 -7
  17. package/dist/module/SystemBars.js.map +1 -1
  18. package/dist/module/expo.js +17 -4
  19. package/dist/module/expo.js.map +1 -1
  20. package/dist/module/specs/NativeEdgeToEdgeModule.js.map +1 -1
  21. package/dist/typescript/SystemBars.d.ts.map +1 -1
  22. package/dist/typescript/expo.d.ts +6 -4
  23. package/dist/typescript/expo.d.ts.map +1 -1
  24. package/dist/typescript/specs/NativeEdgeToEdgeModule.d.ts +1 -0
  25. package/dist/typescript/specs/NativeEdgeToEdgeModule.d.ts.map +1 -1
  26. package/dist/typescript/types.d.ts +8 -5
  27. package/dist/typescript/types.d.ts.map +1 -1
  28. package/package.json +6 -6
  29. package/src/SystemBars.ts +27 -6
  30. package/src/expo.ts +33 -8
  31. package/src/specs/NativeEdgeToEdgeModule.ts +1 -0
  32. package/src/types.ts +5 -2
  33. package/android/src/main/res/values-v29/colors.xml +0 -4
package/src/expo.ts CHANGED
@@ -4,19 +4,37 @@ import {
4
4
  withAndroidStyles,
5
5
  } from "@expo/config-plugins";
6
6
 
7
- type Theme = "Material2" | "Material3";
8
- type Props = { android?: { parentTheme?: Theme } } | undefined;
7
+ type ParentTheme =
8
+ | "Default"
9
+ | "Material2"
10
+ | "Material3"
11
+ | "Light"
12
+ | "Material2.Light"
13
+ | "Material3.Light";
14
+
15
+ type AndroidProps = {
16
+ enforceNavigationBarContrast?: boolean;
17
+ parentTheme?: ParentTheme;
18
+ };
19
+
20
+ type Props = { android?: AndroidProps } | undefined;
9
21
 
10
22
  const withAndroidEdgeToEdgeTheme: ConfigPlugin<Props> = (
11
23
  config,
12
24
  props = {},
13
25
  ) => {
14
- const themes: Record<string, string> = {
26
+ const themes: Record<ParentTheme, string> = {
27
+ Default: "Theme.EdgeToEdge",
15
28
  Material2: "Theme.EdgeToEdge.Material2",
16
29
  Material3: "Theme.EdgeToEdge.Material3",
17
- } satisfies Record<Theme, string>;
18
30
 
19
- const ignoreList = new Set([
31
+ Light: "Theme.EdgeToEdge.Light",
32
+ "Material2.Light": "Theme.EdgeToEdge.Material2.Light",
33
+ "Material3.Light": "Theme.EdgeToEdge.Material3.Light",
34
+ };
35
+
36
+ const cleanupList = new Set([
37
+ "enforceNavigationBarContrast",
20
38
  "android:enforceNavigationBarContrast",
21
39
  "android:enforceStatusBarContrast",
22
40
  "android:fitsSystemWindows",
@@ -34,19 +52,26 @@ const withAndroidEdgeToEdgeTheme: ConfigPlugin<Props> = (
34
52
  const { androidStatusBar = {}, userInterfaceStyle = "light" } = config;
35
53
  const { barStyle } = androidStatusBar;
36
54
  const { android = {} } = props;
37
- const { parentTheme = "Default" } = android;
55
+ const { enforceNavigationBarContrast, parentTheme = "Default" } = android;
38
56
 
39
57
  config.modResults.resources.style = config.modResults.resources.style?.map(
40
58
  (style): typeof style => {
41
59
  if (style.$.name === "AppTheme") {
42
- style.$.parent = themes[parentTheme] ?? "Theme.EdgeToEdge";
60
+ style.$.parent = themes[parentTheme] ?? themes["Default"];
43
61
 
44
62
  if (style.item != null) {
45
63
  style.item = style.item.filter(
46
- (item) => !ignoreList.has(item.$.name),
64
+ (item) => !cleanupList.has(item.$.name),
47
65
  );
48
66
  }
49
67
 
68
+ if (enforceNavigationBarContrast === false) {
69
+ style.item.push({
70
+ $: { name: "enforceNavigationBarContrast" },
71
+ _: String(false),
72
+ });
73
+ }
74
+
50
75
  if (barStyle != null) {
51
76
  style.item.push({
52
77
  $: { name: "android:windowLightStatusBar" },
@@ -5,6 +5,7 @@ type SystemBarsConfig = {
5
5
  statusBarHidden: boolean | undefined;
6
6
  statusBarStyle: string | undefined;
7
7
  navigationBarHidden: boolean | undefined;
8
+ navigationBarStyle: string | undefined;
8
9
  };
9
10
 
10
11
  export interface Spec extends TurboModule {
package/src/types.ts CHANGED
@@ -1,12 +1,15 @@
1
+ type SystemBarsProp<T> = T | { statusBar?: T; navigationBar?: T };
2
+
1
3
  export type SystemBarStyle = "auto" | "light" | "dark";
2
4
 
3
5
  export type SystemBarsEntry = {
4
6
  statusBarHidden: boolean | undefined;
5
7
  statusBarStyle: SystemBarStyle | undefined;
6
8
  navigationBarHidden: boolean | undefined;
9
+ navigationBarStyle: SystemBarStyle | undefined;
7
10
  };
8
11
 
9
12
  export type SystemBarsProps = {
10
- style?: SystemBarStyle;
11
- hidden?: boolean | { statusBar?: boolean; navigationBar?: boolean };
13
+ style?: SystemBarsProp<SystemBarStyle>;
14
+ hidden?: SystemBarsProp<boolean>;
12
15
  };
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <resources>
3
- <color name="navigationBarColor">@android:color/transparent</color>
4
- </resources>