Commit 35396ef
authored
[expo-image-picker] Handle edge-to-edge (expo#44208)
# Why
Closes expo#44164
The `expo-image-picker` `ExpoCropImageActivity` doesn't handle
edge-to-edge display properly on Android. The crop view overlaps with
system bars and display cutouts, and the status bar theming uses the
deprecated `window.statusBarColor` API (that has no effect on Android
16+).
# How
- Enabled edge-to-edge rendering with `WindowCompat.enableEdgeToEdge`.
- Added window insets listeners to properly inset the `CropImageView`
margins so it avoids system bars.
- Replaced the deprecated `window.statusBarColor` with a custom status
bar background view sized dynamically via insets.
- Apply both status and navigation bar style.
- Inlined the palette/theming logic from `ExpoCropImageUtils` directly
into `ExpoCropImageActivity`, removing the now-unused
`applyPaletteToOptions` and `applyWindowTheming` utility methods.
- Added `androidx.core:core-ktx:1.17.0` dependency for
`enableEdgeToEdge` / `updateLayoutParams`.
# Test Plan
- Open the image picker with cropping enabled on an Android device with
edge-to-edge display (Android 15+). Verify the crop view doesn't overlap
with the status bar, navigation bar, or display cutouts. Test in both
light and dark modes.
- Do the same test on Android < 15. It should be edge-to-edge too.
# Checklist
- [x] I added a `changelog.md` entry and rebuilt the package sources
according to [this short
guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
# Screenshots
### Android 16 - Light mode
<img width="265" height="489" alt="Screenshot 2026-03-24 at 20 22 34"
src="https://github.com/user-attachments/assets/56754ea7-3e85-4780-b453-73968263c697"
/>
### Android 16 - Dark mode
<img width="265" height="489" alt="Screenshot 2026-03-24 at 20 25 35"
src="https://github.com/user-attachments/assets/cbd5c9d9-282b-4e31-bae1-c1fb3bde1329"
/>
### Android 16 - Custom colors
<img width="265" height="489" alt="Screenshot 2026-03-24 at 20 27 21"
src="https://github.com/user-attachments/assets/c60376c7-cce4-4b6f-97e2-47a2a71d38ea"
/>
### Android 14 - Light mode
<img width="260" height="483" alt="Screenshot 2026-03-24 at 20 29 50"
src="https://github.com/user-attachments/assets/bff85951-423a-4d66-a18b-95a8239ea47e"
/>1 parent f094314 commit 35396ef
4 files changed
Lines changed: 99 additions & 67 deletions
File tree
- packages/expo-image-picker
- android
- src/main/java/expo/modules/imagepicker
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
packages/expo-image-picker/android/src/main/java/expo/modules/imagepicker/ExpoCropImageActivity.kt
Lines changed: 96 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
5 | 12 | | |
6 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
7 | 17 | | |
8 | 18 | | |
9 | 19 | | |
| |||
15 | 25 | | |
16 | 26 | | |
17 | 27 | | |
| 28 | + | |
18 | 29 | | |
19 | 30 | | |
20 | 31 | | |
| |||
23 | 34 | | |
24 | 35 | | |
25 | 36 | | |
26 | | - | |
| 37 | + | |
27 | 38 | | |
28 | 39 | | |
29 | 40 | | |
30 | 41 | | |
31 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
32 | 52 | | |
33 | 53 | | |
34 | 54 | | |
| |||
40 | 60 | | |
41 | 61 | | |
42 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
43 | 82 | | |
44 | 83 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
48 | 87 | | |
49 | | - | |
50 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
51 | 103 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 104 | + | |
| 105 | + | |
56 | 106 | | |
57 | 107 | | |
58 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
59 | 145 | | |
60 | 146 | | |
61 | 147 | | |
| |||
Lines changed: 1 addition & 57 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
| |||
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
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 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | 31 | | |
0 commit comments