-
-
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
Incorrect childCount in removeViewAt #2282
Comments
@BenIrving Thanks for reporting the issue, I am working on a possible fix. |
I have also encountered this issue, for now I reverted #2134 since it would cause screens to go completely blank when navigating back to it. |
@alduzy I can confirm the workaround fixes the issue. Is there any progress on a proper fix here? |
@BenIrving There is a fix, but not the prettiest one. I'll prepare a PR |
…t on fabric (#2307) ## Description This PR intents to fix the crash when navigating back from a screen with FlatList on the new architecture. The crash was caused by miscalculated `childCount` of the list. Earlier on I found out that setting the [removeClippedSubviews](https://reactnative.dev/docs/flatlist#removeclippedsubviews) option to false (defaults to true on Android) in the FlatList fixes the problem. This PR is rather a quick fix with an extra condition, that adds simple views in place of the miscalculated ones in `startTransitionRecursive` function if there's a FlatList with `removeClippedSubviews` option set. Fixes #2282. ## Changes - added `Test2282.tsx` repro - added extra condition in `startTransitionRecursive` function <!-- ## 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 - added `Test2282.tsx` repro ## Checklist - [x] Ensured that CI passes
I am still facing the issue when i am using sectionlist and flatlist. And I am getting the error while navigating back. Below is the sectionlist component `import React, { useState } from 'react'; const SectionListItem = ({ sections = [] }) => { const toggleSection = (title: any) => { const renderSlotCard = ({ item }) => ( const renderDayHeader = (day: string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor> | Iterable<React.ReactNode> | React.ReactPortal | null | undefined) => ( const renderHorizontalList = ({ data }) => ( const renderSectionHeader = ({ section: { title } }) => {
}; const renderSectionFooter = ({ section }) => {
}; return ( export default SectionListItem; |
…t on fabric (software-mansion#2307) ## Description This PR intents to fix the crash when navigating back from a screen with FlatList on the new architecture. The crash was caused by miscalculated `childCount` of the list. Earlier on I found out that setting the [removeClippedSubviews](https://reactnative.dev/docs/flatlist#removeclippedsubviews) option to false (defaults to true on Android) in the FlatList fixes the problem. This PR is rather a quick fix with an extra condition, that adds simple views in place of the miscalculated ones in `startTransitionRecursive` function if there's a FlatList with `removeClippedSubviews` option set. Fixes software-mansion#2282. ## Changes - added `Test2282.tsx` repro - added extra condition in `startTransitionRecursive` function <!-- ## 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 - added `Test2282.tsx` repro ## Checklist - [x] Ensured that CI passes
…t on fabric (#2307) This PR intents to fix the crash when navigating back from a screen with FlatList on the new architecture. The crash was caused by miscalculated `childCount` of the list. Earlier on I found out that setting the [removeClippedSubviews](https://reactnative.dev/docs/flatlist#removeclippedsubviews) option to false (defaults to true on Android) in the FlatList fixes the problem. This PR is rather a quick fix with an extra condition, that adds simple views in place of the miscalculated ones in `startTransitionRecursive` function if there's a FlatList with `removeClippedSubviews` option set. Fixes #2282. - added `Test2282.tsx` repro - added extra condition in `startTransitionRecursive` function <!-- Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. --> - added `Test2282.tsx` repro - [x] Ensured that CI passes (cherry picked from commit c47ad84)
Description
There is a bug in react-native-screens on Android when newArchEnabled=true and we have FlatLists in our screens
We attempt to remove an incorrect number of children when calling removeViewAt in SurfaceMountingManager
This seems related to the changes introduced by @WoLewicki in 2134 as we patched these changes into a previous version of rns and this bug became immediately apparent. This was tested on rn73 & rn74 as well
Steps to reproduce
Snack or a link to a repository
https://github.com/BenIrving/rnsrepro
Screens version
3.34.0
React Native version
0.75.0-rc.6
Platforms
Android
JavaScript runtime
None
Workflow
React Native (without Expo)
Architecture
Fabric (New Architecture)
Build type
Debug mode
Device
None
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: