react-native-edge-to-edge 0.0.0 → 0.1.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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +154 -0
  3. package/android/build.gradle +73 -0
  4. package/android/src/main/AndroidManifest.xml +3 -0
  5. package/android/src/main/AndroidManifestNew.xml +3 -0
  6. package/android/src/main/java/com/zoontek/rnedgetoedge/RNEdgeToEdgeModuleImpl.kt +120 -0
  7. package/android/src/main/java/com/zoontek/rnedgetoedge/RNEdgeToEdgePackage.kt +36 -0
  8. package/android/src/main/res/values/colors.xml +8 -0
  9. package/android/src/main/res/values/public.xml +4 -0
  10. package/android/src/main/res/values/styles.xml +16 -0
  11. package/android/src/main/res/values-night/styles.xml +6 -0
  12. package/android/src/main/res/values-v26/styles.xml +6 -0
  13. package/android/src/main/res/values-v27/styles.xml +8 -0
  14. package/android/src/main/res/values-v29/styles.xml +9 -0
  15. package/android/src/main/res/values-v30/styles.xml +9 -0
  16. package/android/src/newarch/com/zoontek/rnedgetoedge/RNEdgeToEdgeModule.kt +33 -0
  17. package/android/src/oldarch/com/zoontek/rnedgetoedge/RNBarsModule.kt +36 -0
  18. package/app.plugin.js +1 -0
  19. package/dist/commonjs/NativeRNEdgeToEdge.js +9 -0
  20. package/dist/commonjs/NativeRNEdgeToEdge.js.map +1 -0
  21. package/dist/commonjs/SystemBars.js +180 -0
  22. package/dist/commonjs/SystemBars.js.map +1 -0
  23. package/dist/commonjs/expo.js +35 -0
  24. package/dist/commonjs/expo.js.map +1 -0
  25. package/dist/commonjs/index.js +32 -0
  26. package/dist/commonjs/index.js.map +1 -0
  27. package/dist/commonjs/types.js +2 -0
  28. package/dist/commonjs/types.js.map +1 -0
  29. package/dist/module/NativeRNEdgeToEdge.js +5 -0
  30. package/dist/module/NativeRNEdgeToEdge.js.map +1 -0
  31. package/dist/module/SystemBars.js +175 -0
  32. package/dist/module/SystemBars.js.map +1 -0
  33. package/dist/module/expo.js +31 -0
  34. package/dist/module/expo.js.map +1 -0
  35. package/dist/module/index.js +5 -0
  36. package/dist/module/index.js.map +1 -0
  37. package/dist/module/package.json +1 -0
  38. package/dist/module/types.js +2 -0
  39. package/dist/module/types.js.map +1 -0
  40. package/dist/typescript/NativeRNEdgeToEdge.d.ts +12 -0
  41. package/dist/typescript/NativeRNEdgeToEdge.d.ts.map +1 -0
  42. package/dist/typescript/SystemBars.d.ts +8 -0
  43. package/dist/typescript/SystemBars.d.ts.map +1 -0
  44. package/dist/typescript/expo.d.ts +4 -0
  45. package/dist/typescript/expo.d.ts.map +1 -0
  46. package/dist/typescript/index.d.ts +3 -0
  47. package/dist/typescript/index.d.ts.map +1 -0
  48. package/dist/typescript/types.d.ts +14 -0
  49. package/dist/typescript/types.d.ts.map +1 -0
  50. package/package.json +73 -6
  51. package/src/NativeRNEdgeToEdge.ts +14 -0
  52. package/src/SystemBars.ts +222 -0
  53. package/src/expo.ts +55 -0
  54. package/src/index.ts +2 -0
  55. package/src/types.ts +12 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Mathieu Acthernoene
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,154 @@
1
+ # react-native-edge-to-edge
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.
4
+
5
+ [![mit licence](https://img.shields.io/dub/l/vibe-d.svg?style=for-the-badge)](https://github.com/zoontek/react-native-edge-to-edge/blob/main/LICENSE)
6
+ [![npm version](https://img.shields.io/npm/v/react-native-edge-to-edge?style=for-the-badge)](https://www.npmjs.org/package/react-native-edge-to-edge)
7
+ [![npm downloads](https://img.shields.io/npm/dt/react-native-edge-to-edge.svg?label=downloads&style=for-the-badge)](https://www.npmjs.org/package/react-native-edge-to-edge)
8
+
9
+ <img width="240" src="./docs/logo.svg" alt="Logo">
10
+
11
+ ## Credits
12
+
13
+ This project has been built and is maintained thanks to the support from [Expo](https://expo.dev).
14
+
15
+ <a href="https://expo.io">
16
+ <img width="180" src="./docs/expo.svg" alt="Expo">
17
+ </a>
18
+
19
+ ## Support
20
+
21
+ This library follows the React Native [releases support policy](https://github.com/reactwg/react-native-releases/blob/main/docs/support.md).<br>
22
+ It is supporting the **latest version**, and the **two previous minor series**.
23
+
24
+ ## Motivations
25
+
26
+ ### Android 15
27
+
28
+ With the upcoming release of Android 15, Google is introducing a significant change: apps targeting SDK 35 [will have edge-to-edge enforcement](https://developer.android.com/about/versions/15/behavior-changes-15#edge-to-edge). Currently, the latest version of React Native targets SDK 34, so this isn't an issue **yet**, but it will be in a future release.
29
+
30
+ ### Immersive mode
31
+
32
+ [Immersive mode](https://developer.android.com/develop/ui/views/layout/immersive) allows you to hide the status and navigation bars, making it ideal for full-screen experiences. Currently, the built-in [`StatusBar`](https://reactnative.dev/docs/statusbar) component uses [`FLAG_FULLSCREEN`](https://developer.android.com/reference/android/view/WindowManager.LayoutParams#FLAG_FULLSCREEN), a flag that has been deprecated since Android 11.
33
+
34
+ ### Consistency
35
+
36
+ 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.
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ $ npm i -S react-native-edge-to-edge
42
+ # --- or ---
43
+ $ yarn add react-native-edge-to-edge
44
+ ```
45
+
46
+ ### Expo
47
+
48
+ 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/):
49
+
50
+ ```diff
51
+ {
52
+ "expo": {
53
+ + "plugins": ["react-native-edge-to-edge"]
54
+ }
55
+ }
56
+ ```
57
+
58
+ > [!NOTE]
59
+ > This library is not yet supported in the [Expo Go](https://expo.dev/go) sandbox app.
60
+
61
+ ### Bare React Native
62
+
63
+ Edit your `android/app/src/main/res/values/styles.xml` file to inherit from the provided theme:
64
+
65
+ ```diff
66
+ <resources>
67
+ - <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
68
+ + <style name="AppTheme" parent="Theme.EdgeToEdge">
69
+ <!-- … -->
70
+ </style>
71
+ </resources>
72
+ ```
73
+
74
+ ## Considerations
75
+
76
+ ### Third-party libraries
77
+
78
+ Many libraries expose options that you can set to account for the transparency of status and navigation bars. For example, the [`useHideAnimation`](https://github.com/zoontek/react-native-bootsplash?tab=readme-ov-file#usehideanimation) hook in `react-native-bootsplash` has `statusBarTranslucent` and `navigationBarTranslucent` options, the [`useAnimatedKeyboard`](https://docs.swmansion.com/react-native-reanimated/docs/device/useAnimatedKeyboard) in `react-native-reanimated` has an `isStatusBarTranslucentAndroid` option, etc.
79
+
80
+ > [!IMPORTANT]
81
+ > 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.
82
+
83
+ For library authors, we provide a lightweight package called `react-native-is-edge-to-edge` (note the `-is-`!), which checks whether `react-native-edge-to-edge` is installed, making it easy to update your library accordingly:
84
+
85
+ ```ts
86
+ import { isEdgeToEdge } from "react-native-is-edge-to-edge";
87
+
88
+ if (isEdgeToEdge()) {
89
+ // …do something
90
+ }
91
+ ```
92
+
93
+ ### Keyboard management
94
+
95
+ Enabling edge-to-edge display disrupts basic 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.
96
+
97
+ ### Safe area management
98
+
99
+ Effective safe area management is essential to prevent content from being displayed behind transparent system bars. To achieve this, we highly recommend using [`react-native-safe-area-context`](https://github.com/th3rdwave/react-native-safe-area-context), a well-known and trusted library.
100
+
101
+ ### Modal component quirks
102
+
103
+ Status bar management has never worked effectively with the built-in [`Modal`](https://reactnative.dev/docs/modal) component (as it creates a `Dialog` with a `Window` instance distinct from `MainActivity`). A `statusBarTranslucent` prop was introduced, but it is insufficient because there is no equivalent for the navigation bar. Instead, we recommend using the [react-navigation modals](https://reactnavigation.org/docs/modal), which do not suffer from this issue, as they utilize [react-native-screens](https://docs.swmansion.com/react-native-screens) and `Fragment` behind the scenes.
104
+
105
+ ## API
106
+
107
+ > [!WARNING]
108
+ > The API is subject to change before reaching version **1.0.0**.
109
+
110
+ ### `<SystemBars />`
111
+
112
+ A component for managing your app's system bars. This replace [`StatusBar`](https://reactnative.dev/docs/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/) (that uses a lot of now [deprecated APIs](https://developer.android.com/about/versions/15/behavior-changes-15#deprecated-apis)).
113
+
114
+ ```tsx
115
+ import { SystemBars } from "react-native-edge-to-edge";
116
+
117
+ type SystemBarsProps = {
118
+ // Sets the color of the status bar content (navigation bar adjusts itself automatically)
119
+ // "auto" is based on current color scheme (light -> dark content, dark -> light content)
120
+ style?: "auto" | "light" | "dark";
121
+ // Hide system bars (the navigation bar cannot be hidden on iOS)
122
+ hidden?: boolean | { statusBar?: boolean; navigationBar?: boolean };
123
+ };
124
+
125
+ const App = () => (
126
+ <>
127
+ <SystemBars style="light" />
128
+ {/* … */}
129
+ </>
130
+ );
131
+ ```
132
+
133
+ #### SystemBars.pushStackEntry
134
+
135
+ ```ts
136
+ const entry: SystemBarsEntry = SystemBars.pushStackEntry(
137
+ props /*: SystemBarsProps */,
138
+ );
139
+ ```
140
+
141
+ #### SystemBars.popStackEntry
142
+
143
+ ```ts
144
+ SystemBars.popStackEntry(entry /*: SystemBarsEntry */);
145
+ ```
146
+
147
+ #### SystemBars.replaceStackEntry
148
+
149
+ ```ts
150
+ const entry: SystemBarsEntry = SystemBars.replaceStackEntry(
151
+ entry /*: SystemBarsEntry */,
152
+ props /*: SystemBarsProps */,
153
+ );
154
+ ```
@@ -0,0 +1,73 @@
1
+ buildscript {
2
+ ext.safeExtGet = {prop, fallback ->
3
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
4
+ }
5
+ repositories {
6
+ google()
7
+ gradlePluginPortal()
8
+ }
9
+ dependencies {
10
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet("kotlinVersion", "1.8.0")}")
11
+ classpath("com.android.tools.build:gradle:8.1.1")
12
+ }
13
+ }
14
+
15
+ def isNewArchitectureEnabled() {
16
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
17
+ }
18
+
19
+ apply plugin: "com.android.library"
20
+ apply plugin: "kotlin-android"
21
+
22
+ if (isNewArchitectureEnabled()) {
23
+ apply plugin: "com.facebook.react"
24
+ }
25
+
26
+ android {
27
+ buildToolsVersion safeExtGet("buildToolsVersion", "34.0.0")
28
+ compileSdkVersion safeExtGet("compileSdkVersion", 34)
29
+
30
+ if (project.android.hasProperty("namespace")) {
31
+ namespace "com.zoontek.rnedgetoedge"
32
+
33
+ buildFeatures {
34
+ buildConfig true
35
+ }
36
+ sourceSets {
37
+ main {
38
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
39
+ }
40
+ }
41
+ }
42
+ defaultConfig {
43
+ buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
44
+ minSdkVersion safeExtGet("minSdkVersion", 23)
45
+ targetSdkVersion safeExtGet("targetSdkVersion", 34)
46
+ }
47
+ lintOptions {
48
+ abortOnError false
49
+ }
50
+ sourceSets {
51
+ main {
52
+ if (isNewArchitectureEnabled()) {
53
+ java.srcDirs += ["src/newarch"]
54
+ } else {
55
+ java.srcDirs += ["src/oldarch"]
56
+ }
57
+ }
58
+ }
59
+ }
60
+
61
+ repositories {
62
+ maven {
63
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
64
+ url("$rootDir/../node_modules/react-native/android")
65
+ }
66
+ mavenCentral()
67
+ google()
68
+ }
69
+
70
+ dependencies {
71
+ //noinspection GradleDynamicVersion
72
+ implementation "com.facebook.react:react-native:+" // From node_modules
73
+ }
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.zoontek.rnedgetoedge">
3
+ </manifest>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
+ </manifest>
@@ -0,0 +1,120 @@
1
+ package com.zoontek.rnedgetoedge
2
+
3
+ import android.app.Activity
4
+ import android.content.res.Configuration
5
+ import android.graphics.Color
6
+ import android.os.Build
7
+ import android.util.TypedValue
8
+ import android.view.WindowManager
9
+
10
+ import androidx.core.content.ContextCompat
11
+ import androidx.core.view.WindowCompat
12
+ import androidx.core.view.WindowInsetsCompat
13
+ import androidx.core.view.WindowInsetsControllerCompat
14
+
15
+ import com.facebook.common.logging.FLog
16
+ import com.facebook.react.bridge.ReadableMap
17
+ import com.facebook.react.common.ReactConstants
18
+
19
+ object RNEdgeToEdgeModuleImpl {
20
+ const val NAME = "RNEdgeToEdge"
21
+ private var isInitialHostResume = true
22
+
23
+ fun onHostResume(activity: Activity?) {
24
+ if (activity == null) {
25
+ return FLog.w(ReactConstants.TAG, "$NAME: Ignored, current activity is null.")
26
+ }
27
+
28
+ activity.runOnUiThread {
29
+ val window = activity.window
30
+ val view = window.decorView
31
+ val context = view.context
32
+
33
+ val isDarkMode =
34
+ view.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK ==
35
+ Configuration.UI_MODE_NIGHT_YES
36
+
37
+ WindowCompat.setDecorFitsSystemWindows(window, false)
38
+
39
+ window.statusBarColor = Color.TRANSPARENT
40
+
41
+ window.navigationBarColor = when {
42
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> Color.TRANSPARENT
43
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !isDarkMode ->
44
+ ContextCompat.getColor(context, R.color.systemBarLightScrim)
45
+ else -> ContextCompat.getColor(context, R.color.systemBarDarkScrim)
46
+ }
47
+
48
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
49
+ window.isStatusBarContrastEnforced = false
50
+ window.isNavigationBarContrastEnforced = true
51
+ }
52
+
53
+ WindowInsetsControllerCompat(window, view).run {
54
+ if (isInitialHostResume) {
55
+ val typedValue = TypedValue()
56
+
57
+ isAppearanceLightStatusBars = activity
58
+ .theme
59
+ .resolveAttribute(android.R.attr.windowLightStatusBar, typedValue, true) &&
60
+ typedValue.data != 0
61
+ }
62
+
63
+ isInitialHostResume = false
64
+ isAppearanceLightNavigationBars = !isDarkMode
65
+ }
66
+
67
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
68
+ window.attributes.layoutInDisplayCutoutMode = when {
69
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.R ->
70
+ WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
71
+ else -> WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ fun onHostDestroy() {
78
+ isInitialHostResume = true
79
+ }
80
+
81
+ fun setSystemBarsConfig(activity: Activity?, config: ReadableMap) {
82
+ if (activity == null) {
83
+ return FLog.w(ReactConstants.TAG, "$NAME: Ignored, current activity is null.")
84
+ }
85
+
86
+ val statusBarHidden =
87
+ config.takeIf { it.hasKey("statusBarHidden") }?.getBoolean("statusBarHidden")
88
+ val statusBarStyle =
89
+ config.takeIf { it.hasKey("statusBarStyle") }?.getString("statusBarStyle")
90
+ val navigationBarHidden =
91
+ config.takeIf { it.hasKey("navigationBarHidden") }?.getBoolean("navigationBarHidden")
92
+
93
+ activity.runOnUiThread {
94
+ val window = activity.window
95
+ val insetsController = WindowInsetsControllerCompat(window, window.decorView)
96
+
97
+ statusBarStyle?.let {
98
+ insetsController.isAppearanceLightStatusBars = it == "dark"
99
+ }
100
+
101
+ if (statusBarHidden != null || navigationBarHidden != null) {
102
+ insetsController.systemBarsBehavior =
103
+ WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
104
+
105
+ statusBarHidden?.let {
106
+ when (it) {
107
+ true -> insetsController.hide(WindowInsetsCompat.Type.statusBars())
108
+ else -> insetsController.show(WindowInsetsCompat.Type.statusBars())
109
+ }
110
+ }
111
+ navigationBarHidden?.let {
112
+ when (it) {
113
+ true -> insetsController.hide(WindowInsetsCompat.Type.navigationBars())
114
+ else -> insetsController.show(WindowInsetsCompat.Type.navigationBars())
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
@@ -0,0 +1,36 @@
1
+ package com.zoontek.rnedgetoedge
2
+
3
+ import com.facebook.react.TurboReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfo
7
+ import com.facebook.react.module.model.ReactModuleInfoProvider
8
+
9
+ class RNEdgeToEdgePackage : TurboReactPackage() {
10
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
11
+ return when (name) {
12
+ RNEdgeToEdgeModuleImpl.NAME -> RNEdgeToEdgeModule(reactContext)
13
+ else -> null
14
+ }
15
+ }
16
+
17
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
18
+ return ReactModuleInfoProvider {
19
+ val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
20
+ val isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
21
+
22
+ val moduleInfo = ReactModuleInfo(
23
+ RNEdgeToEdgeModuleImpl.NAME,
24
+ RNEdgeToEdgeModuleImpl.NAME,
25
+ false,
26
+ false,
27
+ true,
28
+ false,
29
+ isTurboModule
30
+ )
31
+
32
+ moduleInfos[RNEdgeToEdgeModuleImpl.NAME] = moduleInfo
33
+ moduleInfos
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <!-- https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/res/remote_color_resources_res/values/colors.xml;l=67 -->
4
+ <!-- https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/res/res/color/system_bar_background_semi_transparent.xml -->
5
+ <color name="systemBarDarkScrim">#801b1b1b</color>
6
+ <!-- https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/com/android/internal/policy/DecorView.java;l=142 -->
7
+ <color name="systemBarLightScrim">#e6ffffff</color>
8
+ </resources>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <public name="Theme.EdgeToEdge" type="style" />
4
+ </resources>
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <style name="Theme.EdgeToEdge.Base" parent="Theme.AppCompat.DayNight.NoActionBar">
4
+ <item name="android:windowLightStatusBar">true</item>
5
+ </style>
6
+
7
+ <style name="Theme.EdgeToEdge.Common" parent="Theme.EdgeToEdge.Base">
8
+ <item name="android:fitsSystemWindows">false</item>
9
+ <item name="android:windowDrawsSystemBarBackgrounds">true</item>
10
+ <item name="android:statusBarColor">@android:color/transparent</item>
11
+ </style>
12
+
13
+ <style name="Theme.EdgeToEdge" parent="Theme.EdgeToEdge.Common">
14
+ <item name="android:navigationBarColor">@color/systemBarDarkScrim</item>
15
+ </style>
16
+ </resources>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <style name="Theme.EdgeToEdge.Base" parent="Theme.AppCompat.DayNight.NoActionBar">
4
+ <item name="android:windowLightStatusBar">false</item>
5
+ </style>
6
+ </resources>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <style name="Theme.EdgeToEdge" parent="Theme.EdgeToEdge.Common">
4
+ <item name="android:navigationBarColor">@color/systemBarLightScrim</item>
5
+ </style>
6
+ </resources>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <style name="Theme.EdgeToEdge" parent="Theme.EdgeToEdge.Common">
4
+ <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
5
+ <item name="android:navigationBarColor">@color/systemBarLightScrim</item>
6
+ <item name="android:windowLightNavigationBar">true</item>
7
+ </style>
8
+ </resources>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <style name="Theme.EdgeToEdge" parent="Theme.EdgeToEdge.Common">
4
+ <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
5
+ <item name="android:enforceStatusBarContrast">false</item>
6
+ <item name="android:enforceNavigationBarContrast">true</item>
7
+ <item name="android:navigationBarColor">@android:color/transparent</item>
8
+ </style>
9
+ </resources>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <style name="Theme.EdgeToEdge" parent="Theme.EdgeToEdge.Common">
4
+ <item name="android:windowLayoutInDisplayCutoutMode">always</item>
5
+ <item name="android:enforceStatusBarContrast">false</item>
6
+ <item name="android:enforceNavigationBarContrast">true</item>
7
+ <item name="android:navigationBarColor">@android:color/transparent</item>
8
+ </style>
9
+ </resources>
@@ -0,0 +1,33 @@
1
+ package com.zoontek.rnedgetoedge
2
+
3
+ import com.facebook.react.bridge.LifecycleEventListener
4
+ import com.facebook.react.bridge.ReactApplicationContext
5
+ import com.facebook.react.bridge.ReadableMap
6
+ import com.facebook.react.module.annotations.ReactModule
7
+
8
+ @ReactModule(name = RNEdgeToEdgeModuleImpl.NAME)
9
+ class RNEdgeToEdgeModule(reactContext: ReactApplicationContext?) :
10
+ NativeRNEdgeToEdgeSpec(reactContext), LifecycleEventListener {
11
+
12
+ init {
13
+ reactApplicationContext.addLifecycleEventListener(this)
14
+ }
15
+
16
+ override fun getName(): String {
17
+ return RNEdgeToEdgeModuleImpl.NAME
18
+ }
19
+
20
+ override fun onHostResume() {
21
+ RNEdgeToEdgeModuleImpl.onHostResume(currentActivity)
22
+ }
23
+
24
+ override fun onHostPause() {}
25
+
26
+ override fun onHostDestroy() {
27
+ RNEdgeToEdgeModuleImpl.onHostDestroy()
28
+ }
29
+
30
+ override fun setSystemBarsConfig(config: ReadableMap) {
31
+ RNEdgeToEdgeModuleImpl.setSystemBarsConfig(currentActivity, config)
32
+ }
33
+ }
@@ -0,0 +1,36 @@
1
+ package com.zoontek.rnedgetoedge
2
+
3
+ import com.facebook.react.bridge.LifecycleEventListener
4
+ import com.facebook.react.bridge.ReactApplicationContext
5
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
6
+ import com.facebook.react.bridge.ReactMethod
7
+ import com.facebook.react.bridge.ReadableMap
8
+ import com.facebook.react.module.annotations.ReactModule
9
+
10
+ @ReactModule(name = RNEdgeToEdgeModuleImpl.NAME)
11
+ class RNEdgeToEdgeModule(reactContext: ReactApplicationContext?) :
12
+ ReactContextBaseJavaModule(reactContext), LifecycleEventListener {
13
+
14
+ init {
15
+ reactApplicationContext.addLifecycleEventListener(this)
16
+ }
17
+
18
+ override fun getName(): String {
19
+ return RNEdgeToEdgeModuleImpl.NAME
20
+ }
21
+
22
+ override fun onHostResume() {
23
+ RNEdgeToEdgeModuleImpl.onHostResume(currentActivity)
24
+ }
25
+
26
+ override fun onHostPause() {}
27
+
28
+ override fun onHostDestroy() {
29
+ RNEdgeToEdgeModuleImpl.onHostDestroy()
30
+ }
31
+
32
+ @ReactMethod
33
+ fun setSystemBarsConfig(config: ReadableMap) {
34
+ RNEdgeToEdgeModuleImpl.setSystemBarsConfig(currentActivity, config)
35
+ }
36
+ }
package/app.plugin.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("./dist/commonjs/expo");
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _default = exports.default = _reactNative.TurboModuleRegistry.get("RNEdgeToEdge");
9
+ //# sourceMappingURL=NativeRNEdgeToEdge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeRNEdgeToEdge.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAYpCC,gCAAmB,CAACC,GAAG,CAAO,cAAc,CAAC","ignoreList":[]}