Commit 7ac4bb6
authored
fix(Android, FormSheet): Prevent BottomSheetBehavior override when using FormSheets (#3912)
## Description
When `headerTransparent: true` is configured,
`setToolbarTranslucent(true)` is invoked. Previously, this method
overwrote the behavior with `null`. For FormSheet presentation, this
unintentionally destroyed the BottomSheetBehavior. When
`handleInsetsUpdateAndNotifyTransition` was invoked, the call to
`screen.sheetBehavior!!` was crashing with `NullPointerException`.
> [!NOTE]
> Native header isn't supported on Android currently:
https://reactnavigation.org/docs/native-stack-navigator/#android-specific-limitations
- this issue aims only to resolve the crash, but for now we're not
planning to add this feature for v4.
> [!NOTE]
> I deliberately removed SAV from the original repro, as it seems to be
causing another issue:
software-mansion/react-native-screens-labs#968
- adding it to my queue
Closes
#3910
## Changes
- Guarded `setToolbarTranslucent` to only modify the layout behavior if
we're not in the FormSheet presentation.
## Before & after - visual documentation
| Before | After |
| --- | --- |
| <video
src="https://github.com/user-attachments/assets/7ad82901-f3ca-4dbd-9f81-d117b46cfce3"
/> | <video
src="https://github.com/user-attachments/assets/03a630d1-2224-4788-8697-621c238d04f1"
/> |
## Test plan
Added Test3910
## Checklist
- [ ] Included code example that can be used to test this change.
- [ ] For visual changes, included screenshots / GIFs / recordings
documenting the change.
- [ ] For API changes, updated relevant public types.
- [ ] Ensured that CI passes1 parent 6ae17e0 commit 7ac4bb6
3 files changed
Lines changed: 65 additions & 3 deletions
File tree
- android/src/main/java/com/swmansion/rnscreens
- apps/src/tests/issue-tests
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
131 | | - | |
132 | | - | |
133 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
| |||
583 | 589 | | |
584 | 590 | | |
585 | 591 | | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
586 | 596 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
| |||
0 commit comments