-
-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(Android): going back on fabric with nested list #2383
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic keeps on growing and I am not happy about it at all. But until we find better way of handling it, I think we have to try and fix those edge cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like the idea of iterating up the whole tree for each child for each transition, but I guess that is better than crashing 🤷🏻♂️
We should add a comment above this function that it serves purposes of a workaround, refer to the startTransitionRecursive
function and link this PR.
Also: do we actually know what changed that this started crashing (maybe in react-native)? Because it looks like the root cause of the issue is on react-native side. The issue reporter of #2341 noted that this happens since 0.75 onwards. What has changed? @WoLewicki do you have some context?
return false | ||
} | ||
var parentView = child.parent | ||
while (parentView is ViewGroup && parentView !is ScreenStack) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be enough to check for Screen
, right? Screen
will be direct descendant of ScreenStack
and we don't want to look further up. Am I right here?
while (parentView is ViewGroup && parentView !is ScreenStack) { | |
while (parentView is ViewGroup && parentView !is Screen) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loop actually finishes quicker with this check for ScreenStack
. It's because the ActionMenuView
goes through the loop as well and there's no Screen
between it and the ScreenStack
. I didn't want to add yet another check for that.
Nope, but would be nice to find out what changed and maybe iterate on it to handle it in core instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're good. Thank you!
…#2383) ## Description This PR intents to fix crash happening on Android (fabric) when navigating back from a screen with nested list. ### Before 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"> | ### After 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: software-mansion#2341 ## Changes - added `isInsideScrollViewWithRemoveClippedSubviews` check to `startTransitionRecursive` - modified `Test2282.tsx` repro <!-- ## Screenshots / GIFs Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. ### Before ### After --> ## Test code and steps to reproduce - use `Test2282.tsx` repro ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
## Description This PR handles yet another case for going back on fabric. In the previous one (#2383) I omitted a case where a horizontal list is simply rendered w/o being nested in any other list! Fixes #2341 ## Changes - updated `Test2292.tsx` repro - handle `parentView is ReactHorizontalScrollView` <!-- ## Screenshots / GIFs Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. ### Before ### After --> ## Test code and steps to reproduce - use `Test2282.tsx` repro ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
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)
## Description This PR handles yet another case for going back on fabric. In the previous one (#2383) I omitted a case where a horizontal list is simply rendered w/o being nested in any other list! Fixes #2341 ## Changes - updated `Test2292.tsx` repro - handle `parentView is ReactHorizontalScrollView` <!-- ## Screenshots / GIFs Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. ### Before ### After --> ## Test code and steps to reproduce - use `Test2282.tsx` repro ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes (cherry picked from commit d40e108)
## Description This PR intents to fix going back on fabric issue when using a `View` with [removeClippedSubviews](https://reactnative.dev/docs/view#removeclippedsubviews) prop set to true. Previous bug fixes addressed this issue primarily for FlatLists, where it's set to true by default on Android. See #2383. Additionally, this PR greatly improves the performance of `startTransitionRecursive` as it does not climb up the tree in search for a parent with `removeClippedSubview` set to true anymore. Fixes #2491 . ## Changes - removed redundant code - updated `Test2282.tsx` repro <!-- ## Screenshots / GIFs Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. ### Before ### After --> ## Test code and steps to reproduce - use `Test2282.tsx` repro ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes --------- Co-authored-by: Kacper Kafara <[email protected]>
Description
This PR intents to fix crash happening on Android (fabric) when navigating back from a screen with nested list.
Before
The crash happens whenever the nested list is visible on the screen, as shown below:
After
Screen.Recording.2024-10-08.at.13.58.22.mov
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 enabled.
Fixes: #2341
Changes
isInsideScrollViewWithRemoveClippedSubviews
check tostartTransitionRecursive
Test2282.tsx
reproTest code and steps to reproduce
Test2282.tsx
reproChecklist