Skip to content

Reset nextFocusLeft when recycling Android views - #60171

Open
lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-60167-recycled-next-focus-left
Open

lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-60167-recycled-next-focus-left

Conversation

@lazerg

@lazerg lazerg commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Summary:

With view recycling on, a recycled View keeps the nextFocusLeft of the view that used it before, so D-pad Left from the new view jumps to the old target. BaseViewManager.prepareToRecycleView resets nextFocusDown, nextFocusForward, nextFocusRight and nextFocusUp to View.NO_ID but missed nextFocusLeft, and a new view without the prop never sets it again. This resets it with the others.

Fixes #60167

Changelog:

[ANDROID] [FIXED] - Recycled views no longer keep the nextFocusLeft of their previous props

Test Plan:

Added testRecycledViewDropsTheNextFocusLeftOfItsPreviousProps to BaseViewManagerTest. It fails on main (nextFocusLeftId is still 10) and passes with this change. ./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest passes, and the Java and Kotlin format checks are clean. I didn't run the reproducer on a device.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 20, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 20, 2026
@github-actions

Copy link
Copy Markdown

Visual regression

No visual differences at a071cb7742ac.

ios: no capture

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android: with view recycling on, a recycled View keeps its nextFocusLeft

1 participant