Commit c2280e3
Handle edge-to-edge when it's not enabled by gradle property (#56055)
Summary:
On Android 15 (API 35), edge-to-edge is enforced by default unless the app explicitly opts out via `windowOptOutEdgeToEdgeEnforcement`. On Android 16+, it's always enforced regardless.
Previously, edge-to-edge behavior was only driven by the `edgeToEdgeEnabled` gradle property, meaning apps on Android 15+ could be in edge-to-edge mode without React Native being aware of it, leading to incorrect insets / layout behavior.
This PR introduces `isEdgeToEdge`, a computed value that accounts for the OS-level enforcement in addition to the gradle flag, and replaces most usages of `isEdgeToEdgeFeatureFlagOn` with it. A new `initEdgeToEdge(context, flag)` function replaces `setEdgeToEdgeFeatureFlagOn()` and reads the theme attribute to detect opt-out on API 35.
## Changelog:
[ANDROID] [FIXED] - Handle edge-to-edge when it's not enabled by the `edgeToEdgeEnabled` gradle property but enforced by the OS (Android 15+)
Pull Request resolved: #56055
Test Plan:
- Verify on Android 15 device/emulator **without** `edgeToEdgeEnabled = true`: `isEdgeToEdge` should be `true` (unless opted out via theme attribute).
- Verify on Android 16+ device/emulator: `isEdgeToEdge` should always be `true`.
- Verify on Android 14 and below without the flag: `isEdgeToEdge` should be `false`.
- Verify with `edgeToEdgeEnabled = true`: behavior unchanged, `isEdgeToEdge` is `true` on all API levels.
Reviewed By: javache
Differential Revision: D100437440
fbshipit-source-id: 7cc826ccd2d1596121671eb456358f558e14299c1 parent a4f78b3 commit c2280e3
3 files changed
Lines changed: 49 additions & 6 deletions
File tree
- packages/react-native/ReactAndroid/src/main/java/com/facebook/react
- util
- views/view
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
143 | | - | |
| 141 | + | |
144 | 142 | | |
145 | 143 | | |
146 | 144 | | |
| |||
Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
26 | 34 | | |
27 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
28 | 45 | | |
29 | 46 | | |
30 | 47 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
40 | 68 | | |
41 | 69 | | |
42 | 70 | | |
| |||
0 commit comments