Commit d83d4b7
fix(Android): going back on fabric with nested list (#2383)
This PR intents to fix crash happening on Android (fabric) when
navigating back from a screen with nested list.
The crash happens whenever the nested list is visible on the screen, as
shown below:
| ✅ | ❌ | ❌ | ❌ | ✅ |
|----------|----------|----------|----------|----------|
| <img width="247" alt="Screenshot 2024-10-03 at 16 12 16"
src="https://github.com/user-attachments/assets/55f36653-9451-48a1-b4fc-9d419622fe2b">
| <img width="247" alt="Screenshot 2024-10-03 at 16 12 25"
src="https://github.com/user-attachments/assets/5cc1af46-4418-40de-9391-6dc5168e08af">
| <img width="247" alt="Screenshot 2024-10-03 at 16 12 34"
src="https://github.com/user-attachments/assets/d2ec614a-fbeb-4717-8aeb-328e3a890cd6">
| <img width="247" alt="Screenshot 2024-10-03 at 16 12 40"
src="https://github.com/user-attachments/assets/5d634fbd-45c9-4612-9dcf-25cf8b9295a0">
| <img width="247" alt="Screenshot 2024-10-03 at 16 12 47"
src="https://github.com/user-attachments/assets/0881dd80-ff98-4ba2-992e-933d549eed19">
|
https://github.com/user-attachments/assets/fb36d030-ef53-493d-a8cc-38be670ee504
Nested lists are rendered as ViewGroups, thus the check for
ReactScrollView fails. This PR fixes the issue by checking wether the
view is an indirect child of a ScrollView with
[removeClippedSubviews](https://reactnative.dev/docs/optimizing-flatlist-configuration#removeclippedsubviews)
enabled.
Fixes: #2341
- added `isInsideScrollViewWithRemoveClippedSubviews` check to
`startTransitionRecursive`
- modified `Test2282.tsx` repro
<!--
Here you can add screenshots / GIFs documenting your change.
You can add before / after section if you're changing some behavior.
-->
- use `Test2282.tsx` repro
- [x] Included code example that can be used to test this change
- [x] Ensured that CI passes
(cherry picked from commit b67af86)1 parent 173110d commit d83d4b7
File tree
3 files changed
+161
-21
lines changed- android/src/main/java/com/swmansion/rnscreens
- ext
- apps/src/tests
3 files changed
+161
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
| 314 | + | |
315 | 315 | | |
316 | | - | |
317 | | - | |
| 316 | + | |
| 317 | + | |
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| |||
Lines changed: 49 additions & 0 deletions
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | | - | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
5 | 15 | | |
6 | | - | |
| 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 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
7 | 55 | | |
8 | | - | |
9 | | - | |
10 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
11 | 68 | | |
12 | | - | |
13 | | - | |
| 69 | + | |
| 70 | + | |
14 | 71 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
18 | 82 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 83 | + | |
| 84 | + | |
22 | 85 | | |
23 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
24 | 89 | | |
25 | 90 | | |
26 | 91 | | |
27 | | - | |
28 | | - | |
| 92 | + | |
| 93 | + | |
29 | 94 | | |
30 | 95 | | |
31 | 96 | | |
32 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
0 commit comments