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

Cannot remove child at index X from parent ViewGroup X, only X children in parent. Warning: childCount may be incorrect! #2491

Closed
maciekBudzinski opened this issue Nov 12, 2024 · 6 comments · Fixed by #2495
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snack or repo is provided

Comments

@maciekBudzinski
Copy link

Description

[Android Only] Application crashes when unmounting a screen with removeClippedSubviews set to true.

Steps to reproduce

Run application from reproduction repository (rnscreens branch).
Press login, then logout, see the application crash:

rnscreens_demo.webm

Snack or a link to a repository

https://github.com/maciekBudzinski/rnp-material-bottom-tabs-repro-issue/tree/rnscreens

Screens version

4.0.0

React Native version

0.76.1

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

Android emulator

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Platform: Android This issue is specific to Android Repro provided A reproduction with a snack or repo is provided labels Nov 12, 2024
@alduzy alduzy self-assigned this Nov 12, 2024
@alduzy
Copy link
Member

alduzy commented Nov 12, 2024

@maciekBudzinski Thanks for reporting and providing a reproducible code! I opened a PR that aims to fix the problem.

@alduzy alduzy removed their assignment Nov 15, 2024
kkafar added a commit that referenced this issue Nov 15, 2024
## 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]>
@marcio-b
Copy link

@alduzy Hey! thank you for addressing this! I was wondering if that PR triggers a new release and if not, what version of the library should we get to have this fix you pushed?

@kkafar
Copy link
Member

kkafar commented Nov 16, 2024

Hey, I'll release version on Monday / Tuesday at latest

@marcio-b
Copy link

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

@kkafar
Copy link
Member

kkafar commented Nov 20, 2024

Thanks a lot @marcio-b!

@maciekBudzinski
Copy link
Author

Thanks 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants