Skip to content
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

Android - "cannot remove child at index X" error on new architecture #2339

Closed
cjpete opened this issue Sep 11, 2024 · 23 comments
Closed

Android - "cannot remove child at index X" error on new architecture #2339

cjpete opened this issue Sep 11, 2024 · 23 comments
Labels
Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android

Comments

@cjpete
Copy link

cjpete commented Sep 11, 2024

Description

When navigating back from a stack screen which contains a FlatList, the app throws a soft error:

Cannot remove child at index 9 from parent ViewGroup [106], only 10 children in parent. Warning: childCount may be incorrect!

null
image
IssueWithFlatListFabric.mov

Steps to reproduce

  1. Open the repro app
  2. Navigate to the flatlist screen
  3. Press header back button
  4. Observe error

Snack or a link to a repository

https://github.com/72days/TestNavFlatListIssues

Screens version

3.34.0

React Native version

0.75.2

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

Real device

Device model

Samsung S9 and Pixel 1

Acknowledgements

Yes

@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Sep 11, 2024
Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added the Platform: Android This issue is specific to Android label Sep 11, 2024
@cjpete
Copy link
Author

cjpete commented Sep 11, 2024

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

There is a reproduction example in the issue: https://github.com/72days/TestNavFlatListIssues

@cjpete
Copy link
Author

cjpete commented Sep 11, 2024

FYI this is also an issue with 3.35.0-rc.1

@arnabJ
Copy link

arnabJ commented Sep 14, 2024

Temporarily add this to FlatList to fix the issue:

<FlatList
    data={images}
    numColumns={3}
    contentContainerStyle={[{paddingHorizontal: 10}, containerStyle]}
    renderItem={renderItem}
    removeClippedSubviews={false} // <- Add This
/>

Got this workaround from: #2282

@alduzy
Copy link
Member

alduzy commented Oct 10, 2024

I believe it's the same issue: #2282
The problem has been recently revisited by: #2383

@alduzy alduzy closed this as completed Oct 10, 2024
@WKampel
Copy link

WKampel commented Oct 12, 2024

Still happens in latest beta version (4.0.0-beta.9)

@alduzy
Copy link
Member

alduzy commented Oct 14, 2024

@WKampel Can you attach a reproduction?

@abhayagrawal-fareye
Copy link

Facing this issue with RN 0.75.4 and react-native-screens - 3.34.0

@Aamir0890
Copy link

facing this issue with "react-native-screens": "^3.35.0", and "react-native": "0.76.0",

@alduzy
Copy link
Member

alduzy commented Nov 6, 2024

The issue should be gone in 3.35.0. If the problem persists please attach a reproduction code.

@delphinebugner
Copy link

Had the issue with 3.34.0, just upgraded to 3.35.0 and it did fix it, thanks @alduzy 🙂

@jaemushim
Copy link

Facing this issue with react native 0.76.1, react native screens 3.35.0

@pj-prize
Copy link

Same, seeing this issue in RN 0.76.1 and RN Screens 3.35.0

@marcio-b
Copy link

Same issue in RN 0.76.1 and RNScreens 3.35.0. I also tried updating RNScreens to 4.1.0 and had the same result.

@alduzy
Copy link
Member

alduzy commented Nov 15, 2024

Related issue: #2491

@marcio-b
Copy link

I just wanted to confirm that issue is resolved in v4.2.0.

@pj-prize
Copy link

pj-prize commented Nov 20, 2024

Confirmed that this is fixed for me with RN 0.76.2 and RN Screens 4.2.0. Thank you for your help!

@Yousuf223
Copy link

cannot remove child at index 7 from parent ViewGroup [416], only 8 childern in parent. warning: childCount may be Incorrect!

@tree1891
Copy link

same issue
RN 0.76.5
RN Screens 4.3.0

@saimarshadsaim31
Copy link

I was also facing this issue, not for flatlist but in some other part of the app. was using v4.0.0, upgraded to 4.2.0 and it got fixed!

@hasangonen91
Copy link

"react-native-screens": "3.34.0", to "3.35.0", working for me

@KhuongVo2105
Copy link

image
this also happens in RN 0.76.5 and RN screens 4.4.0. I went into android/gradle.properties and changed to newArchEnabled=false
image

@ponikar
Copy link

ponikar commented Jan 27, 2025

I am still facing this issue with new arch enabled. Its happening randomly after spending serval minutes.
I have multiple list components in the screen.

"react-native-screens": "^4.4.0",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android
Projects
None yet
Development

No branches or pull requests