Skip to content

Commit e4cfad4

Browse files
committed
Improve documentation
1 parent 7b80de6 commit e4cfad4

File tree

1 file changed

+65
-65
lines changed

1 file changed

+65
-65
lines changed

README.md

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ It is supporting the **latest version**, and the **two previous minor series**.
2323

2424
## Motivations
2525

26-
### Android 15
27-
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).
26+
### Consistency
2927

30-
Currently, new React Native projects target SDK 34.
28+
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.
3129

3230
### Immersive mode
3331

3432
[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.
3533

36-
### Consistency
34+
### Android 15
3735

38-
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.
36+
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).
37+
38+
Currently, new React Native projects target SDK 34.
3939

4040
## Installation
4141

@@ -87,76 +87,23 @@ Edit your `android/app/src/main/res/values/styles.xml` file to inherit from one
8787

8888
## Considerations
8989

90-
### Third-party libraries
91-
92-
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.
93-
94-
> [!IMPORTANT]
95-
> 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.
96-
97-
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:
98-
99-
```ts
100-
import {
101-
controlEdgeToEdgeValues,
102-
isEdgeToEdge,
103-
} from "react-native-is-edge-to-edge";
104-
105-
const EDGE_TO_EDGE = isEdgeToEdge();
106-
107-
function MyAwesomeLibraryComponent({
108-
statusBarTranslucent,
109-
navigationBarTranslucent,
110-
}) {
111-
if (__DEV__) {
112-
// warn the user once about unnecessary defined values
113-
controlEdgeToEdgeValues({
114-
statusBarTranslucent,
115-
navigationBarTranslucent,
116-
});
117-
}
118-
119-
return (
120-
<MyAwesomeLibraryNativeComponent
121-
statusBarTranslucent={EDGE_TO_EDGE || statusBarTranslucent}
122-
navigationBarTranslucent={EDGE_TO_EDGE || navigationBarTranslucent}
123-
//
124-
/>
125-
);
126-
}
127-
```
128-
129-
If you want to check for the library's presence on the native side to bypass certain parts of your code, consider using this small utility:
130-
131-
```kotlin
132-
object EdgeToEdge {
133-
// we cannot detect edge-to-edge, but we can detect react-native-edge-to-edge install
134-
val ENABLED: Boolean = try {
135-
Class.forName("com.zoontek.rnedgetoedge.EdgeToEdgePackage")
136-
true
137-
} catch (exception: ClassNotFoundException) {
138-
false
139-
}
140-
}
141-
```
142-
143-
### Keyboard management
144-
145-
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.
146-
14790
### Safe area management
14891

14992
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.
15093

15194
### Modal component quirks
15295

153-
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.
96+
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).
97+
98+
### Keyboard management
99+
100+
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.
154101

155102
## API
156103

157104
### `<SystemBars />`
158105

159-
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)).
106+
A component for managing your app's system bars. Replace all occurrences of [`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/) with it (they uses a lot of now [deprecated APIs](https://developer.android.com/about/versions/15/behavior-changes-15#deprecated-apis) and interfere with edge-to-edge).
160107

161108
```tsx
162109
import { SystemBars } from "react-native-edge-to-edge";
@@ -199,3 +146,56 @@ const entry: SystemBarsEntry = SystemBars.replaceStackEntry(
199146
props /*: SystemBarsProps */,
200147
);
201148
```
149+
150+
## Third-party
151+
152+
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.
153+
154+
> [!IMPORTANT]
155+
> 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.
156+
157+
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:
158+
159+
```ts
160+
import {
161+
controlEdgeToEdgeValues,
162+
isEdgeToEdge,
163+
} from "react-native-is-edge-to-edge";
164+
165+
const EDGE_TO_EDGE = isEdgeToEdge();
166+
167+
function MyAwesomeLibraryComponent({
168+
statusBarTranslucent,
169+
navigationBarTranslucent,
170+
}) {
171+
if (__DEV__) {
172+
// warn the user once about unnecessary defined values
173+
controlEdgeToEdgeValues({
174+
statusBarTranslucent,
175+
navigationBarTranslucent,
176+
});
177+
}
178+
179+
return (
180+
<MyAwesomeLibraryNativeComponent
181+
statusBarTranslucent={EDGE_TO_EDGE || statusBarTranslucent}
182+
navigationBarTranslucent={EDGE_TO_EDGE || navigationBarTranslucent}
183+
//
184+
/>
185+
);
186+
}
187+
```
188+
189+
If you want to check for the library's presence on the native side to bypass certain parts of your code, consider using this small utility:
190+
191+
```kotlin
192+
object EdgeToEdge {
193+
// we cannot detect edge-to-edge, but we can detect react-native-edge-to-edge install
194+
val ENABLED: Boolean = try {
195+
Class.forName("com.zoontek.rnedgetoedge.EdgeToEdgePackage")
196+
true
197+
} catch (exception: ClassNotFoundException) {
198+
false
199+
}
200+
}
201+
```

0 commit comments

Comments
 (0)