react-native-edge-to-edge 1.2.0 → 1.3.1
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/README.md +63 -78
- package/android/src/main/java/com/zoontek/rnedgetoedge/EdgeToEdgeModuleImpl.kt +59 -15
- package/android/src/main/java/com/zoontek/rnedgetoedge/EdgeToEdgePackage.kt +5 -5
- package/android/src/main/res/values/attrs.xml +5 -0
- package/android/src/main/res/values/public.xml +2 -0
- package/android/src/main/res/values/styles.xml +21 -3
- package/android/src/main/res/values-v27/colors.xml +1 -2
- package/android/src/main/res/values-v27/styles.xml +3 -3
- package/android/src/main/res/values-v29/styles.xml +9 -9
- package/android/src/main/res/values-v30/styles.xml +9 -9
- package/dist/commonjs/SystemBars.js +18 -7
- package/dist/commonjs/SystemBars.js.map +1 -1
- package/dist/commonjs/expo.js +11 -2
- package/dist/commonjs/expo.js.map +1 -1
- package/dist/commonjs/specs/NativeEdgeToEdgeModule.js.map +1 -1
- package/dist/module/SystemBars.js +18 -7
- package/dist/module/SystemBars.js.map +1 -1
- package/dist/module/expo.js +11 -2
- package/dist/module/expo.js.map +1 -1
- package/dist/module/specs/NativeEdgeToEdgeModule.js.map +1 -1
- package/dist/typescript/SystemBars.d.ts.map +1 -1
- package/dist/typescript/expo.d.ts +6 -4
- package/dist/typescript/expo.d.ts.map +1 -1
- package/dist/typescript/specs/NativeEdgeToEdgeModule.d.ts +1 -0
- package/dist/typescript/specs/NativeEdgeToEdgeModule.d.ts.map +1 -1
- package/dist/typescript/types.d.ts +8 -5
- package/dist/typescript/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/SystemBars.ts +27 -6
- package/src/expo.ts +19 -6
- package/src/specs/NativeEdgeToEdgeModule.ts +1 -0
- package/src/types.ts +5 -2
- package/android/src/main/res/values-v29/colors.xml +0 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# react-native-edge-to-edge
|
|
2
2
|
|
|
3
|
-
Effortlessly enable [edge-to-edge](https://developer.android.com/develop/ui/views/layout/edge-to-edge) display in React Native, allowing your Android app content to flow seamlessly beneath the system bars.
|
|
3
|
+
Effortlessly enable [edge-to-edge](https://developer.android.com/develop/ui/views/layout/edge-to-edge) display in React Native, allowing your Android (v6 and above) app content to flow seamlessly beneath the system bars.
|
|
4
4
|
|
|
5
5
|
[](https://github.com/zoontek/react-native-edge-to-edge/blob/main/LICENSE)
|
|
6
6
|
[](https://www.npmjs.org/package/react-native-edge-to-edge)
|
|
@@ -27,8 +27,6 @@ It is supporting the **latest version**, and the **two previous minor series**.
|
|
|
27
27
|
|
|
28
28
|
Recently, Google introduced a significant change: apps targeting SDK 35 will have edge-to-edge display [enforced by default](https://developer.android.com/about/versions/15/behavior-changes-15#edge-to-edge) on Android 15+. Google is _likely_ to mandate that app updates on the Play Store target SDK 35 starting on August 31, 2025. This assumption is based on the [previous years' requirements following a similar timeline](https://support.google.com/googleplay/android-developer/answer/11926878?sjid=11853000253346477363-EU#zippy=%2Care-there-any-exceptions-for-existing-apps-targeting-api-or-below:~:text=App%20update%20requirements).
|
|
29
29
|
|
|
30
|
-
Currently, new React Native projects target SDK 34.
|
|
31
|
-
|
|
32
30
|
### Consistency
|
|
33
31
|
|
|
34
32
|
iOS has long used edge-to-edge displays, so adopting this design across all platforms ensures a consistent user experience. It also simplifies managing safe areas, eliminating the need for special cases specific to Android.
|
|
@@ -45,16 +43,37 @@ $ npm i -S react-native-edge-to-edge
|
|
|
45
43
|
$ yarn add react-native-edge-to-edge
|
|
46
44
|
```
|
|
47
45
|
|
|
46
|
+
### Pick a parent theme
|
|
47
|
+
|
|
48
|
+
This library requires you to update the parent of your Android `AppTheme` to an edge-to-edge version. Don't worry, it's very easy to understand! You just need to choose a theme based on the current value:
|
|
49
|
+
|
|
50
|
+
| If you currently have… | …you should use |
|
|
51
|
+
| :---------------------------------------------- | :--------------------------------- |
|
|
52
|
+
| `Theme.AppCompat.DayNight.NoActionBar` | `Theme.EdgeToEdge` |
|
|
53
|
+
| `Theme.MaterialComponents.DayNight.NoActionBar` | `Theme.EdgeToEdge.Material2` |
|
|
54
|
+
| `Theme.Material3.DayNight.NoActionBar` | `Theme.EdgeToEdge.Material3` |
|
|
55
|
+
| `Theme.AppCompat.Light.NoActionBar` | `Theme.EdgeToEdge.Light` |
|
|
56
|
+
| `Theme.MaterialComponents.Light.NoActionBar` | `Theme.EdgeToEdge.Material2.Light` |
|
|
57
|
+
| `Theme.Material3.Light.NoActionBar` | `Theme.EdgeToEdge.Material3.Light` |
|
|
58
|
+
|
|
48
59
|
### Expo
|
|
49
60
|
|
|
50
|
-
Add the library plugin in your `app.json` config file and [create a new build](https://docs.expo.dev/develop/development-builds/create-a-build
|
|
61
|
+
Add the library plugin in your `app.json` config file and [create a new build](https://docs.expo.dev/develop/development-builds/create-a-build) 👷:
|
|
51
62
|
|
|
52
|
-
```
|
|
63
|
+
```json
|
|
53
64
|
{
|
|
54
65
|
"expo": {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
"plugins": [
|
|
67
|
+
[
|
|
68
|
+
"react-native-edge-to-edge",
|
|
69
|
+
{
|
|
70
|
+
"android": {
|
|
71
|
+
"parentTheme": "Light",
|
|
72
|
+
"enforceNavigationBarContrast": false
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
]
|
|
58
77
|
}
|
|
59
78
|
}
|
|
60
79
|
```
|
|
@@ -62,18 +81,20 @@ Add the library plugin in your `app.json` config file and [create a new build](h
|
|
|
62
81
|
_📌 The available plugins options are:_
|
|
63
82
|
|
|
64
83
|
```ts
|
|
65
|
-
type
|
|
66
|
-
| "Default" // Theme.EdgeToEdge
|
|
67
|
-
| "Material2" // Theme.EdgeToEdge.Material2
|
|
68
|
-
| "Material3" // Theme.EdgeToEdge.Material3
|
|
69
|
-
| "Light" // Theme.EdgeToEdge.Light
|
|
70
|
-
| "Material2.Light" // Theme.EdgeToEdge.Material2.Light
|
|
71
|
-
| "Material3.Light"; // Theme.EdgeToEdge.Material3.Light
|
|
84
|
+
type ParentTheme =
|
|
85
|
+
| "Default" // uses `Theme.EdgeToEdge`
|
|
86
|
+
| "Material2" // uses `Theme.EdgeToEdge.Material2`
|
|
87
|
+
| "Material3" // uses `Theme.EdgeToEdge.Material3`
|
|
88
|
+
| "Light" // uses `Theme.EdgeToEdge.Light`
|
|
89
|
+
| "Material2.Light" // uses `Theme.EdgeToEdge.Material2.Light`
|
|
90
|
+
| "Material3.Light"; // uses `Theme.EdgeToEdge.Material3.Light`
|
|
72
91
|
|
|
73
92
|
type Options = {
|
|
74
93
|
android?: {
|
|
75
|
-
//
|
|
76
|
-
parentTheme?:
|
|
94
|
+
// see the "Pick a parent theme" section
|
|
95
|
+
parentTheme?: ParentTheme; // optional (default: `Default`)
|
|
96
|
+
// see the "Transparent navigation bar" section
|
|
97
|
+
enforceNavigationBarContrast?: boolean; // optional (default: `true`)
|
|
77
98
|
};
|
|
78
99
|
};
|
|
79
100
|
```
|
|
@@ -85,21 +106,24 @@ type Options = {
|
|
|
85
106
|
|
|
86
107
|
Edit your `android/app/src/main/res/values/styles.xml` file to inherit from one of the provided themes:
|
|
87
108
|
|
|
88
|
-
```
|
|
109
|
+
```xml
|
|
89
110
|
<resources>
|
|
90
|
-
<!--
|
|
91
|
-
|
|
92
|
-
- Theme.EdgeToEdge.Material2 / Theme.EdgeToEdge.Material2.Light
|
|
93
|
-
- Theme.EdgeToEdge.Material3 / Theme.EdgeToEdge.Material3.Light -->
|
|
94
|
-
- <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
|
95
|
-
+ <style name="AppTheme" parent="Theme.EdgeToEdge">
|
|
111
|
+
<!-- update your AppTheme parent (see the "Pick a parent theme" section) -->
|
|
112
|
+
<style name="AppTheme" parent="Theme.EdgeToEdge">
|
|
96
113
|
<!-- … -->
|
|
114
|
+
<!-- disable the contrasting background of the navigation bar (optional) -->
|
|
115
|
+
<item name="enforceNavigationBarContrast">false</item>
|
|
97
116
|
</style>
|
|
98
117
|
</resources>
|
|
99
118
|
```
|
|
100
119
|
|
|
101
120
|
## Considerations
|
|
102
121
|
|
|
122
|
+
### Transparent navigation bar
|
|
123
|
+
|
|
124
|
+
By default, this library adopts [Android 15 defaults](https://developer.android.com/about/versions/15/behavior-changes-15#ux): a fully transparent status bar, a fully transparent gesture navigation bar, and a semi-opaque button navigation bar. To enforce full transparency in all cases, set the `enforceNavigationBarContrast` option to `false`.<br/>
|
|
125
|
+
Note that by doing so, you will need to manage the navigation bar style (using `SystemBars`) in the same way you handle the status bar.
|
|
126
|
+
|
|
103
127
|
### Keyboard management
|
|
104
128
|
|
|
105
129
|
Enabling edge-to-edge display disrupts Android keyboard management (`android:windowSoftInputMode="adjustResize"`), requiring an alternative solution. While [`KeyboardAvoidingView`](https://reactnative.dev/docs/keyboardavoidingview) is a viable option, we recommend using [react-native-keyboard-controller](https://github.com/kirillzyusko/react-native-keyboard-controller) for its enhanced capabilities.
|
|
@@ -112,10 +136,6 @@ Effective safe area management is essential to prevent content from being displa
|
|
|
112
136
|
|
|
113
137
|
Edge-to-edge support for the built-in [`Modal`](https://reactnative.dev/docs/modal) component will be available in [React Native 0.77](https://github.com/facebook/react-native/pull/47254). Meanwhile, we recommend using the [react-navigation modals](https://reactnavigation.org/docs/modal) or the [`expo-router` modal screens](https://docs.expo.dev/router/advanced/modals/#modal-screen-using-expo-router).
|
|
114
138
|
|
|
115
|
-
### 3-button navigation mode
|
|
116
|
-
|
|
117
|
-
This library follows the default [AndroidX `enableEdgeToEdge`](https://developer.android.com/develop/ui/views/layout/edge-to-edge) behavior. The system bars are transparent, except in 3-button navigation mode, where the navigation bar becomes translucent (semi-opaque). Its color adjusts based on light or dark theme.
|
|
118
|
-
|
|
119
139
|
## API
|
|
120
140
|
|
|
121
141
|
### `<SystemBars />`
|
|
@@ -125,11 +145,13 @@ A component for managing your app's system bars. Replace all occurrences of [`St
|
|
|
125
145
|
```tsx
|
|
126
146
|
import { SystemBars } from "react-native-edge-to-edge";
|
|
127
147
|
|
|
148
|
+
// "auto" is based on current color scheme (light -> dark content, dark -> light content)
|
|
149
|
+
type Style = "auto" | "light" | "dark";
|
|
150
|
+
|
|
128
151
|
type SystemBarsProps = {
|
|
129
|
-
//
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// Hide system bars (the navigation bar cannot be hidden on iOS)
|
|
152
|
+
// set the color of the system bar content (as no effect on semi-opaque navigation bar)
|
|
153
|
+
style?: Style | { statusBar?: Style; navigationBar?: Style };
|
|
154
|
+
// hide system bars (the navigation bar cannot be hidden on iOS)
|
|
133
155
|
hidden?: boolean | { statusBar?: boolean; navigationBar?: boolean };
|
|
134
156
|
};
|
|
135
157
|
|
|
@@ -164,55 +186,18 @@ const entry: SystemBarsEntry = SystemBars.replaceStackEntry(
|
|
|
164
186
|
);
|
|
165
187
|
```
|
|
166
188
|
|
|
167
|
-
## Third-party
|
|
189
|
+
## Third-party libraries 🧩
|
|
168
190
|
|
|
169
|
-
|
|
191
|
+
If you're an author and your package interferes with edge-to-edge, refer to the [`react-native-is-edge-to-edge` `README.md`](./react-native-is-edge-to-edge) for compatibility instructions.
|
|
170
192
|
|
|
171
|
-
|
|
172
|
-
> Until third-party libraries officially add support for `react-native-edge-to-edge` to set these options automatically, you may need to adjust these options to prevent interference with the library.
|
|
193
|
+
## Troubleshooting 🤔
|
|
173
194
|
|
|
174
|
-
|
|
195
|
+
#### The system bars stays opaque
|
|
175
196
|
|
|
176
|
-
|
|
177
|
-
import {
|
|
178
|
-
controlEdgeToEdgeValues,
|
|
179
|
-
isEdgeToEdge,
|
|
180
|
-
} from "react-native-is-edge-to-edge";
|
|
181
|
-
|
|
182
|
-
const EDGE_TO_EDGE = isEdgeToEdge();
|
|
183
|
-
|
|
184
|
-
function MyAwesomeLibraryComponent({
|
|
185
|
-
statusBarTranslucent,
|
|
186
|
-
navigationBarTranslucent,
|
|
187
|
-
}) {
|
|
188
|
-
if (__DEV__) {
|
|
189
|
-
// warn the user once about unnecessary defined values
|
|
190
|
-
controlEdgeToEdgeValues({
|
|
191
|
-
statusBarTranslucent,
|
|
192
|
-
navigationBarTranslucent,
|
|
193
|
-
});
|
|
194
|
-
}
|
|
197
|
+
Until third-party libraries officially add support for `react-native-edge-to-edge` to set these options automatically, you may need to adjust them manually to prevent interference with the library.
|
|
195
198
|
|
|
196
|
-
|
|
197
|
-
<MyAwesomeLibraryNativeComponent
|
|
198
|
-
statusBarTranslucent={EDGE_TO_EDGE || statusBarTranslucent}
|
|
199
|
-
navigationBarTranslucent={EDGE_TO_EDGE || navigationBarTranslucent}
|
|
200
|
-
// …
|
|
201
|
-
/>
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
```
|
|
199
|
+
For example, make sure to set `react-native-reanimated` `useAnimatedKeyboard` `isStatusBarTranslucentAndroid` and `isNavigationBarTranslucentAndroid` to `true` (until [this PR](https://github.com/software-mansion/react-native-reanimated/pull/6732) is merged), or to replace all occurrences of the built-in `StatusBar`, [`expo-status-bar`](https://docs.expo.dev/versions/latest/sdk/status-bar) and [`expo-navigation-bar`](https://docs.expo.dev/versions/latest/sdk/navigation-bar/) with `SystemBars`.
|
|
205
200
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
object EdgeToEdge {
|
|
210
|
-
// we cannot detect edge-to-edge, but we can detect react-native-edge-to-edge install
|
|
211
|
-
val ENABLED: Boolean = try {
|
|
212
|
-
Class.forName("com.zoontek.rnedgetoedge.EdgeToEdgePackage")
|
|
213
|
-
true
|
|
214
|
-
} catch (exception: ClassNotFoundException) {
|
|
215
|
-
false
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
```
|
|
201
|
+
#### The navigation bar style is erratic
|
|
202
|
+
|
|
203
|
+
There's currently [an open issue](https://issuetracker.google.com/issues/346386744) with the Android 15 emulator image regarding the navigation bar style when it is is fully transparent. This issue does not occur on physical devices.
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
package com.zoontek.rnedgetoedge
|
|
2
2
|
|
|
3
|
+
import android.os.Build.VERSION
|
|
4
|
+
import android.os.Build.VERSION_CODES
|
|
5
|
+
|
|
6
|
+
import android.app.Activity
|
|
3
7
|
import android.content.res.Configuration
|
|
4
8
|
import android.graphics.Color
|
|
5
|
-
import android.
|
|
9
|
+
import android.util.TypedValue
|
|
6
10
|
import android.view.WindowManager
|
|
7
11
|
|
|
8
|
-
import androidx.core.content.ContextCompat
|
|
9
12
|
import androidx.core.view.WindowCompat
|
|
10
13
|
import androidx.core.view.WindowInsetsCompat
|
|
11
14
|
import androidx.core.view.WindowInsetsControllerCompat
|
|
@@ -15,9 +18,28 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
15
18
|
import com.facebook.react.bridge.ReadableMap
|
|
16
19
|
import com.facebook.react.common.ReactConstants
|
|
17
20
|
|
|
21
|
+
internal val LightNavigationBarColor = Color.argb(0xe6, 0xFF, 0xFF, 0xFF)
|
|
22
|
+
internal val DarkNavigationBarColor = Color.argb(0x80, 0x1b, 0x1b, 0x1b)
|
|
23
|
+
|
|
18
24
|
object EdgeToEdgeModuleImpl {
|
|
19
25
|
const val NAME = "RNEdgeToEdge"
|
|
20
26
|
|
|
27
|
+
private val boolAttributes = mutableMapOf<Int, Boolean>()
|
|
28
|
+
|
|
29
|
+
private fun resolveBoolAttribute(activity: Activity, resId: Int): Boolean =
|
|
30
|
+
boolAttributes.getOrPut(resId) {
|
|
31
|
+
val value = TypedValue()
|
|
32
|
+
activity.theme.resolveAttribute(resId, value, true) && value.data != 0
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private fun isNavigationBarLight(activity: Activity): Boolean =
|
|
36
|
+
resolveBoolAttribute(activity, R.attr.enforceNavigationBarLightTheme) ||
|
|
37
|
+
activity.window.decorView.resources.configuration.uiMode and
|
|
38
|
+
Configuration.UI_MODE_NIGHT_MASK != Configuration.UI_MODE_NIGHT_YES
|
|
39
|
+
|
|
40
|
+
private fun isNavigationBarTransparent(activity: Activity): Boolean =
|
|
41
|
+
!resolveBoolAttribute(activity, R.attr.enforceNavigationBarContrast)
|
|
42
|
+
|
|
21
43
|
@Suppress("DEPRECATION")
|
|
22
44
|
fun applyEdgeToEdge(reactContext: ReactApplicationContext) {
|
|
23
45
|
val activity = reactContext.currentActivity
|
|
@@ -26,29 +48,43 @@ object EdgeToEdgeModuleImpl {
|
|
|
26
48
|
activity.runOnUiThread {
|
|
27
49
|
val window = activity.window
|
|
28
50
|
val view = window.decorView
|
|
29
|
-
val context = view.context
|
|
30
51
|
|
|
31
52
|
WindowCompat.setDecorFitsSystemWindows(window, false)
|
|
32
53
|
|
|
33
54
|
window.statusBarColor = Color.TRANSPARENT
|
|
34
|
-
window.navigationBarColor = ContextCompat.getColor(context, R.color.navigationBarColor)
|
|
35
55
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Configuration.UI_MODE_NIGHT_YES
|
|
56
|
+
if (VERSION.SDK_INT >= VERSION_CODES.O_MR1 && isNavigationBarTransparent(activity)) {
|
|
57
|
+
window.navigationBarColor = Color.TRANSPARENT
|
|
39
58
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
59
|
+
if (VERSION.SDK_INT >= VERSION_CODES.Q) {
|
|
60
|
+
window.isStatusBarContrastEnforced = false
|
|
61
|
+
window.isNavigationBarContrastEnforced = false
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
val isLight = isNavigationBarLight(activity)
|
|
43
65
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
66
|
+
window.navigationBarColor = when {
|
|
67
|
+
VERSION.SDK_INT >= VERSION_CODES.Q -> Color.TRANSPARENT
|
|
68
|
+
VERSION.SDK_INT >= VERSION_CODES.O_MR1 && isLight -> LightNavigationBarColor
|
|
69
|
+
else -> DarkNavigationBarColor
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
WindowInsetsControllerCompat(window, view).run {
|
|
73
|
+
isAppearanceLightNavigationBars = when {
|
|
74
|
+
VERSION.SDK_INT >= VERSION_CODES.O_MR1 -> isLight
|
|
75
|
+
else -> false
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (VERSION.SDK_INT >= VERSION_CODES.Q) {
|
|
80
|
+
window.isStatusBarContrastEnforced = false
|
|
81
|
+
window.isNavigationBarContrastEnforced = true
|
|
82
|
+
}
|
|
47
83
|
}
|
|
48
84
|
|
|
49
|
-
if (
|
|
85
|
+
if (VERSION.SDK_INT >= VERSION_CODES.P) {
|
|
50
86
|
window.attributes.layoutInDisplayCutoutMode = when {
|
|
51
|
-
|
|
87
|
+
VERSION.SDK_INT >= VERSION_CODES.R -> WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
|
|
52
88
|
else -> WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
|
53
89
|
}
|
|
54
90
|
}
|
|
@@ -65,6 +101,8 @@ object EdgeToEdgeModuleImpl {
|
|
|
65
101
|
config.takeIf { it.hasKey("statusBarStyle") }?.getString("statusBarStyle")
|
|
66
102
|
val navigationBarHidden =
|
|
67
103
|
config.takeIf { it.hasKey("navigationBarHidden") }?.getBoolean("navigationBarHidden")
|
|
104
|
+
val navigationBarStyle =
|
|
105
|
+
config.takeIf { it.hasKey("navigationBarStyle") }?.getString("navigationBarStyle")
|
|
68
106
|
|
|
69
107
|
activity.runOnUiThread {
|
|
70
108
|
val window = activity.window
|
|
@@ -74,6 +112,12 @@ object EdgeToEdgeModuleImpl {
|
|
|
74
112
|
insetsController.isAppearanceLightStatusBars = it == "dark"
|
|
75
113
|
}
|
|
76
114
|
|
|
115
|
+
if (VERSION.SDK_INT >= VERSION_CODES.O_MR1 && isNavigationBarTransparent(activity)) {
|
|
116
|
+
navigationBarStyle?.let {
|
|
117
|
+
insetsController.isAppearanceLightNavigationBars = it == "dark"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
77
121
|
if (statusBarHidden != null || navigationBarHidden != null) {
|
|
78
122
|
insetsController.systemBarsBehavior =
|
|
79
123
|
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
package com.zoontek.rnedgetoedge
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
7
|
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
8
|
|
|
9
|
-
class EdgeToEdgePackage :
|
|
9
|
+
class EdgeToEdgePackage : BaseReactPackage() {
|
|
10
10
|
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
11
11
|
return when (name) {
|
|
12
12
|
EdgeToEdgeModuleImpl.NAME -> EdgeToEdgeModule(reactContext)
|
|
@@ -16,7 +16,6 @@ class EdgeToEdgePackage : TurboReactPackage() {
|
|
|
16
16
|
|
|
17
17
|
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
18
18
|
return ReactModuleInfoProvider {
|
|
19
|
-
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
20
19
|
val isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
21
20
|
|
|
22
21
|
val moduleInfo = ReactModuleInfo(
|
|
@@ -29,8 +28,9 @@ class EdgeToEdgePackage : TurboReactPackage() {
|
|
|
29
28
|
isTurboModule
|
|
30
29
|
)
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
mapOf(
|
|
32
|
+
EdgeToEdgeModuleImpl.NAME to moduleInfo
|
|
33
|
+
)
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<resources>
|
|
3
|
+
<public name="enforceNavigationBarContrast" type="attr" />
|
|
4
|
+
|
|
3
5
|
<public name="Theme.EdgeToEdge" type="style" />
|
|
4
6
|
<public name="Theme.EdgeToEdge.Material2" type="style" />
|
|
5
7
|
<public name="Theme.EdgeToEdge.Material3" type="style" />
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<resources>
|
|
3
3
|
<style name="Theme.EdgeToEdge.DayNight.Common" parent="Theme.AppCompat.DayNight.NoActionBar">
|
|
4
|
+
<item name="enforceNavigationBarContrast">true</item>
|
|
5
|
+
<item name="enforceNavigationBarLightTheme">false</item>
|
|
6
|
+
|
|
4
7
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
|
5
8
|
<item name="android:fitsSystemWindows">false</item>
|
|
6
9
|
<item name="android:navigationBarColor">@color/navigationBarColor</item>
|
|
@@ -9,6 +12,9 @@
|
|
|
9
12
|
</style>
|
|
10
13
|
|
|
11
14
|
<style name="Theme.EdgeToEdge.Material2.DayNight.Common" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
|
15
|
+
<item name="enforceNavigationBarContrast">true</item>
|
|
16
|
+
<item name="enforceNavigationBarLightTheme">false</item>
|
|
17
|
+
|
|
12
18
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
|
13
19
|
<item name="android:fitsSystemWindows">false</item>
|
|
14
20
|
<item name="android:navigationBarColor">@color/navigationBarColor</item>
|
|
@@ -17,6 +23,9 @@
|
|
|
17
23
|
</style>
|
|
18
24
|
|
|
19
25
|
<style name="Theme.EdgeToEdge.Material3.DayNight.Common" parent="Theme.Material3.DayNight.NoActionBar">
|
|
26
|
+
<item name="enforceNavigationBarContrast">true</item>
|
|
27
|
+
<item name="enforceNavigationBarLightTheme">false</item>
|
|
28
|
+
|
|
20
29
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
|
21
30
|
<item name="android:fitsSystemWindows">false</item>
|
|
22
31
|
<item name="android:navigationBarColor">@color/navigationBarColor</item>
|
|
@@ -25,27 +34,36 @@
|
|
|
25
34
|
</style>
|
|
26
35
|
|
|
27
36
|
<style name="Theme.EdgeToEdge.Light.Common" parent="Theme.AppCompat.Light.NoActionBar">
|
|
37
|
+
<item name="enforceNavigationBarContrast">true</item>
|
|
38
|
+
<item name="enforceNavigationBarLightTheme">true</item>
|
|
39
|
+
|
|
28
40
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
|
29
41
|
<item name="android:fitsSystemWindows">false</item>
|
|
30
42
|
<item name="android:navigationBarColor">@color/navigationBarColor</item>
|
|
31
43
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
|
32
|
-
<item name="android:windowLightStatusBar"
|
|
44
|
+
<item name="android:windowLightStatusBar">true</item>
|
|
33
45
|
</style>
|
|
34
46
|
|
|
35
47
|
<style name="Theme.EdgeToEdge.Material2.Light.Common" parent="Theme.MaterialComponents.Light.NoActionBar">
|
|
48
|
+
<item name="enforceNavigationBarContrast">true</item>
|
|
49
|
+
<item name="enforceNavigationBarLightTheme">true</item>
|
|
50
|
+
|
|
36
51
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
|
37
52
|
<item name="android:fitsSystemWindows">false</item>
|
|
38
53
|
<item name="android:navigationBarColor">@color/navigationBarColor</item>
|
|
39
54
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
|
40
|
-
<item name="android:windowLightStatusBar"
|
|
55
|
+
<item name="android:windowLightStatusBar">true</item>
|
|
41
56
|
</style>
|
|
42
57
|
|
|
43
58
|
<style name="Theme.EdgeToEdge.Material3.Light.Common" parent="Theme.Material3.Light.NoActionBar">
|
|
59
|
+
<item name="enforceNavigationBarContrast">true</item>
|
|
60
|
+
<item name="enforceNavigationBarLightTheme">true</item>
|
|
61
|
+
|
|
44
62
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
|
45
63
|
<item name="android:fitsSystemWindows">false</item>
|
|
46
64
|
<item name="android:navigationBarColor">@color/navigationBarColor</item>
|
|
47
65
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
|
48
|
-
<item name="android:windowLightStatusBar"
|
|
66
|
+
<item name="android:windowLightStatusBar">true</item>
|
|
49
67
|
</style>
|
|
50
68
|
|
|
51
69
|
<style name="Theme.EdgeToEdge" parent="Theme.EdgeToEdge.DayNight.Common" />
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<resources>
|
|
3
|
-
|
|
4
|
-
<color name="navigationBarColor">#e6ffffff</color>
|
|
3
|
+
<color name="navigationBarColor">@android:color/transparent</color>
|
|
5
4
|
</resources>
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
</style>
|
|
17
17
|
|
|
18
18
|
<style name="Theme.EdgeToEdge.Light" parent="Theme.EdgeToEdge.Light.Common">
|
|
19
|
-
<item name="android:windowLightNavigationBar"
|
|
19
|
+
<item name="android:windowLightNavigationBar">true</item>
|
|
20
20
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
|
21
21
|
</style>
|
|
22
22
|
|
|
23
23
|
<style name="Theme.EdgeToEdge.Material2.Light" parent="Theme.EdgeToEdge.Material2.Light.Common">
|
|
24
|
-
<item name="android:windowLightNavigationBar"
|
|
24
|
+
<item name="android:windowLightNavigationBar">true</item>
|
|
25
25
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
|
26
26
|
</style>
|
|
27
27
|
|
|
28
28
|
<style name="Theme.EdgeToEdge.Material3.Light" parent="Theme.EdgeToEdge.Material3.Light.Common">
|
|
29
|
-
<item name="android:windowLightNavigationBar"
|
|
29
|
+
<item name="android:windowLightNavigationBar">true</item>
|
|
30
30
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
|
31
31
|
</style>
|
|
32
32
|
</resources>
|
|
@@ -4,41 +4,41 @@
|
|
|
4
4
|
<item name="android:windowLightNavigationBar">@bool/windowLightSystemBars</item>
|
|
5
5
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
|
6
6
|
<item name="android:enforceStatusBarContrast">false</item>
|
|
7
|
-
<item name="android:enforceNavigationBarContrast"
|
|
7
|
+
<item name="android:enforceNavigationBarContrast">?enforceNavigationBarContrast</item>
|
|
8
8
|
</style>
|
|
9
9
|
|
|
10
10
|
<style name="Theme.EdgeToEdge.Material2" parent="Theme.EdgeToEdge.Material2.DayNight.Common">
|
|
11
11
|
<item name="android:windowLightNavigationBar">@bool/windowLightSystemBars</item>
|
|
12
12
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
|
13
13
|
<item name="android:enforceStatusBarContrast">false</item>
|
|
14
|
-
<item name="android:enforceNavigationBarContrast"
|
|
14
|
+
<item name="android:enforceNavigationBarContrast">?enforceNavigationBarContrast</item>
|
|
15
15
|
</style>
|
|
16
16
|
|
|
17
17
|
<style name="Theme.EdgeToEdge.Material3" parent="Theme.EdgeToEdge.Material3.DayNight.Common">
|
|
18
18
|
<item name="android:windowLightNavigationBar">@bool/windowLightSystemBars</item>
|
|
19
19
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
|
20
20
|
<item name="android:enforceStatusBarContrast">false</item>
|
|
21
|
-
<item name="android:enforceNavigationBarContrast"
|
|
21
|
+
<item name="android:enforceNavigationBarContrast">?enforceNavigationBarContrast</item>
|
|
22
22
|
</style>
|
|
23
23
|
|
|
24
24
|
<style name="Theme.EdgeToEdge.Light" parent="Theme.EdgeToEdge.Light.Common">
|
|
25
|
-
<item name="android:windowLightNavigationBar"
|
|
25
|
+
<item name="android:windowLightNavigationBar">true</item>
|
|
26
26
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
|
27
27
|
<item name="android:enforceStatusBarContrast">false</item>
|
|
28
|
-
<item name="android:enforceNavigationBarContrast"
|
|
28
|
+
<item name="android:enforceNavigationBarContrast">?enforceNavigationBarContrast</item>
|
|
29
29
|
</style>
|
|
30
30
|
|
|
31
31
|
<style name="Theme.EdgeToEdge.Material2.Light" parent="Theme.EdgeToEdge.Material2.Light.Common">
|
|
32
|
-
<item name="android:windowLightNavigationBar"
|
|
32
|
+
<item name="android:windowLightNavigationBar">true</item>
|
|
33
33
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
|
34
34
|
<item name="android:enforceStatusBarContrast">false</item>
|
|
35
|
-
<item name="android:enforceNavigationBarContrast"
|
|
35
|
+
<item name="android:enforceNavigationBarContrast">?enforceNavigationBarContrast</item>
|
|
36
36
|
</style>
|
|
37
37
|
|
|
38
38
|
<style name="Theme.EdgeToEdge.Material3.Light" parent="Theme.EdgeToEdge.Material3.Light.Common">
|
|
39
|
-
<item name="android:windowLightNavigationBar"
|
|
39
|
+
<item name="android:windowLightNavigationBar">true</item>
|
|
40
40
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
|
41
41
|
<item name="android:enforceStatusBarContrast">false</item>
|
|
42
|
-
<item name="android:enforceNavigationBarContrast"
|
|
42
|
+
<item name="android:enforceNavigationBarContrast">?enforceNavigationBarContrast</item>
|
|
43
43
|
</style>
|
|
44
44
|
</resources>
|
|
@@ -4,41 +4,41 @@
|
|
|
4
4
|
<item name="android:windowLightNavigationBar">@bool/windowLightSystemBars</item>
|
|
5
5
|
<item name="android:windowLayoutInDisplayCutoutMode">always</item>
|
|
6
6
|
<item name="android:enforceStatusBarContrast">false</item>
|
|
7
|
-
<item name="android:enforceNavigationBarContrast"
|
|
7
|
+
<item name="android:enforceNavigationBarContrast">?enforceNavigationBarContrast</item>
|
|
8
8
|
</style>
|
|
9
9
|
|
|
10
10
|
<style name="Theme.EdgeToEdge.Material2" parent="Theme.EdgeToEdge.Material2.DayNight.Common">
|
|
11
11
|
<item name="android:windowLightNavigationBar">@bool/windowLightSystemBars</item>
|
|
12
12
|
<item name="android:windowLayoutInDisplayCutoutMode">always</item>
|
|
13
13
|
<item name="android:enforceStatusBarContrast">false</item>
|
|
14
|
-
<item name="android:enforceNavigationBarContrast"
|
|
14
|
+
<item name="android:enforceNavigationBarContrast">?enforceNavigationBarContrast</item>
|
|
15
15
|
</style>
|
|
16
16
|
|
|
17
17
|
<style name="Theme.EdgeToEdge.Material3" parent="Theme.EdgeToEdge.Material3.DayNight.Common">
|
|
18
18
|
<item name="android:windowLightNavigationBar">@bool/windowLightSystemBars</item>
|
|
19
19
|
<item name="android:windowLayoutInDisplayCutoutMode">always</item>
|
|
20
20
|
<item name="android:enforceStatusBarContrast">false</item>
|
|
21
|
-
<item name="android:enforceNavigationBarContrast"
|
|
21
|
+
<item name="android:enforceNavigationBarContrast">?enforceNavigationBarContrast</item>
|
|
22
22
|
</style>
|
|
23
23
|
|
|
24
24
|
<style name="Theme.EdgeToEdge.Light" parent="Theme.EdgeToEdge.Light.Common">
|
|
25
|
-
<item name="android:windowLightNavigationBar"
|
|
25
|
+
<item name="android:windowLightNavigationBar">true</item>
|
|
26
26
|
<item name="android:windowLayoutInDisplayCutoutMode">always</item>
|
|
27
27
|
<item name="android:enforceStatusBarContrast">false</item>
|
|
28
|
-
<item name="android:enforceNavigationBarContrast"
|
|
28
|
+
<item name="android:enforceNavigationBarContrast">?enforceNavigationBarContrast</item>
|
|
29
29
|
</style>
|
|
30
30
|
|
|
31
31
|
<style name="Theme.EdgeToEdge.Material2.Light" parent="Theme.EdgeToEdge.Material2.Light.Common">
|
|
32
|
-
<item name="android:windowLightNavigationBar"
|
|
32
|
+
<item name="android:windowLightNavigationBar">true</item>
|
|
33
33
|
<item name="android:windowLayoutInDisplayCutoutMode">always</item>
|
|
34
34
|
<item name="android:enforceStatusBarContrast">false</item>
|
|
35
|
-
<item name="android:enforceNavigationBarContrast"
|
|
35
|
+
<item name="android:enforceNavigationBarContrast">?enforceNavigationBarContrast</item>
|
|
36
36
|
</style>
|
|
37
37
|
|
|
38
38
|
<style name="Theme.EdgeToEdge.Material3.Light" parent="Theme.EdgeToEdge.Material3.Light.Common">
|
|
39
|
-
<item name="android:windowLightNavigationBar"
|
|
39
|
+
<item name="android:windowLightNavigationBar">true</item>
|
|
40
40
|
<item name="android:windowLayoutInDisplayCutoutMode">always</item>
|
|
41
41
|
<item name="android:enforceStatusBarContrast">false</item>
|
|
42
|
-
<item name="android:enforceNavigationBarContrast"
|
|
42
|
+
<item name="android:enforceNavigationBarContrast">?enforceNavigationBarContrast</item>
|
|
43
43
|
</style>
|
|
44
44
|
</resources>
|