Skip to content

Dispatch FPS events from ACTION_SCROLL events (#56601)#56601

Closed
Abbondanzo wants to merge 1 commit intofacebook:mainfrom
Abbondanzo:export-D102347043
Closed

Dispatch FPS events from ACTION_SCROLL events (#56601)#56601
Abbondanzo wants to merge 1 commit intofacebook:mainfrom
Abbondanzo:export-D102347043

Conversation

@Abbondanzo
Copy link
Copy Markdown
Contributor

@Abbondanzo Abbondanzo commented Apr 24, 2026

Summary:

ACTION_SCROLL events (mouse wheel, trackpad, joystick) were not participating in FPS performance logging. Touch-driven scrolls already called enableFpsListener/disableFpsListener through handlePostTouchScrolling, which uses a stable-frames heuristic to detect when scrolling has settled (3 consecutive frames with no position change). ACTION_SCROLL events bypassed this entirely.

This adds FPS listener support to the ACTION_SCROLL path by calling enableFpsListener when a scroll event arrives, then delegating to handlePostTouchScrolling for lifecycle management:

  • Snapping ScrollViews (ReactScrollView, ReactHorizontalScrollView): The existing debounce runnable calls flingAndSnap to animate to a snap point. After the snap, handlePostTouchScrolling monitors the animation via the stable-frames mechanism and disables the FPS listener once settled.
  • Non-snapping ScrollViews (ReactScrollView): handlePostTouchScrolling is called directly. Its re-entry guard (mPostTouchRunnable != null) naturally deduplicates across rapid scroll events, while onScrollChanged keeps the monitor alive by setting mActivelyScrolling.

Also nulls mPostTouchRunnable before reassignment in the debounce cancel path to avoid stale references.

Changelog:
[Android][Fixed] - Dispatch FPS performance events for mouse wheel and trackpad scroll interactions in ScrollView

Differential Revision: D102347043

@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
Copy link
Copy Markdown

meta-codesync Bot commented Apr 24, 2026

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

Summary:

`ACTION_SCROLL` events (mouse wheel, trackpad, joystick) were not participating in FPS performance logging. Touch-driven scrolls already called `enableFpsListener`/`disableFpsListener` through `handlePostTouchScrolling`, which uses a stable-frames heuristic to detect when scrolling has settled (3 consecutive frames with no position change). ACTION_SCROLL events bypassed this entirely.

This adds FPS listener support to the `ACTION_SCROLL` path by calling `enableFpsListener` when a scroll event arrives, then delegating to `handlePostTouchScrolling` for lifecycle management:

- **Snapping ScrollViews (`ReactScrollView`, `ReactHorizontalScrollView`):** The existing debounce runnable calls `flingAndSnap` to animate to a snap point. After the snap, `handlePostTouchScrolling` monitors the animation via the stable-frames mechanism and disables the FPS listener once settled.
- **Non-snapping ScrollViews (`ReactScrollView`):** `handlePostTouchScrolling` is called directly. Its re-entry guard (`mPostTouchRunnable != null`) naturally deduplicates across rapid scroll events, while `onScrollChanged` keeps the monitor alive by setting `mActivelyScrolling`.

Also nulls `mPostTouchRunnable` before reassignment in the debounce cancel path to avoid stale references.

Changelog:
[Android][Fixed] - Dispatch FPS performance events for mouse wheel and trackpad scroll interactions in ScrollView

Differential Revision: D102347043
@meta-codesync meta-codesync Bot changed the title Dispatch FPS events from ACTION_SCROLL events Dispatch FPS events from ACTION_SCROLL events (#56601) Apr 24, 2026
@meta-codesync meta-codesync Bot closed this in e0a453c Apr 27, 2026
@facebook-github-tools facebook-github-tools Bot added the Merged This PR has been merged. label Apr 27, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Apr 27, 2026

This pull request has been merged in e0a453c.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @Abbondanzo in e0a453c

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