software-mansion / software-mansion/react-native-screens

View recycling breaks due to fragment view transitions

Open
#3,249 13 comments 5 reactions 1 assignee View on GitHub

@kkafar is already working on this.

Since Sep 25, 2025.

platform:android repro-provided
Dominant language
TypeScript
Stars
3.7k
Forks
714
Avg merge
2d 23h
Merged PRs (30d)
71

Description

Description

When a native view manager reuses native views, such as when turning on View Recycling, there can be crashes caused by the react-native mounting layer trying to add a recycled view which still has a parent attached.

The red view you can see in this video is a recycled view, so each screen will try to use the same native instance of the view:

https://github.com/user-attachments/assets/616e9db4-d51f-4250-8937-1d09d3289f64

addViewAt: failed to insert view [1560] into parent [1564] at index 1
The specified child already has a parent. You must call removeView) on the child's parent first.

To fix this I believe we need to:

  • fix RNS endRemovalTransition in Screen.kt as its currently broken and not correctly ending view transitions
  • make changes in react-native core for handling "in-transition" views

I have a PR that tries to address that issue here:

Steps to reproduce

The reproduction can be seen here:

To test it out simply clone / checkout & build from this branch:

Note: In this reproduction i didn't turn on view reycling, but just always return the same native view instance. This is reproducing how view recycling behaves.

I have an additional reproduction with view recycling in the PoC PR for fixing this issue:

Snack or a link to a repository

https://github.com/hannojg/react-native-screens/tree/reproduction/view-recycling-crashing-on-screen-transitions

Screens version

latest main

React Native version

0.81.1

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

Real device

Device model

No response

Acknowledgements

Yes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.