Skip to content

Mark FPS listener in ScrollViews as final, avoid reset in initView (#56609)#56609

Closed
Abbondanzo wants to merge 1 commit into
react:mainfrom
Abbondanzo:export-D102359747
Closed

Mark FPS listener in ScrollViews as final, avoid reset in initView (#56609)#56609
Abbondanzo wants to merge 1 commit into
react:mainfrom
Abbondanzo:export-D102359747

Conversation

@Abbondanzo

@Abbondanzo Abbondanzo commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary:

mFpsListener is injected via ReactHorizontalScrollView's constructor and should live for the lifetime of the view. However, it was declared as a mutable field and nulled in initView(), which is called both during construction and when the view is recycled in a virtualized list. After recycling, isScrollPerfLoggingEnabled() returned false because mFpsListener was null, silently disabling FPS performance tracking for the rest of that view instance's lifecycle.

The fix moves mFpsListener to a final field initialized in the constructor, and removes the mFpsListener = null assignment from initView(). Applied to ReactScrollView, ReactHorizontalScrollView, and ReactNestedScrollView.

This is a safe change because both view managers are instantiated with a single instance of FPS listener, so recycled view instances will always reference the same FPS listener instance.

Changelog:
[Android][Fixed] - Fix FPS performance listener being cleared on ScrollView recycle

Reviewed By: jehartzog

Differential Revision: D102359747

@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 Apr 24, 2026
@meta-codesync

meta-codesync Bot commented Apr 24, 2026

Copy link
Copy Markdown

@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D102359747.

…eact#56609)

Summary:

`mFpsListener` is injected via `ReactHorizontalScrollView`'s constructor and should live for the lifetime of the view. However, it was declared as a mutable field and nulled in `initView()`, which is called both during construction and when the view is recycled in a virtualized list. After recycling, `isScrollPerfLoggingEnabled()` returned false because `mFpsListener` was null, silently disabling FPS performance tracking for the rest of that view instance's lifecycle.

The fix moves `mFpsListener` to a `final` field initialized in the constructor, and removes the `mFpsListener = null` assignment from `initView()`. Applied to `ReactScrollView`, `ReactHorizontalScrollView`, and `ReactNestedScrollView`.

This is a safe change because both view managers are instantiated with a single instance of FPS listener, so recycled view instances will always reference the same FPS listener instance.

Changelog:
[Android][Fixed] - Fix FPS performance listener being cleared on ScrollView recycle

Reviewed By: jehartzog

Differential Revision: D102359747
@meta-codesync meta-codesync Bot changed the title Mark FPS listener in ScrollViews as final, avoid reset in initView Mark FPS listener in ScrollViews as final, avoid reset in initView (#56609) Apr 28, 2026
@meta-codesync meta-codesync Bot closed this in 59ac1db Apr 28, 2026
@facebook-github-tools facebook-github-tools Bot added the Merged This PR has been merged. label Apr 28, 2026
@meta-codesync

meta-codesync Bot commented Apr 28, 2026

Copy link
Copy Markdown

This pull request has been merged in 59ac1db.

@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @Abbondanzo in 59ac1db

When will my fix make it into a release? | How to file a pick request?

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. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants