Commit 01ace75
Dispatch FPS events from ACTION_SCROLL events
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: D1023470431 parent 6411611 commit 01ace75
3 files changed
Lines changed: 15 additions & 2 deletions
File tree
- packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
859 | 859 | | |
860 | 860 | | |
861 | 861 | | |
| 862 | + | |
862 | 863 | | |
863 | 864 | | |
864 | 865 | | |
865 | 866 | | |
866 | 867 | | |
867 | 868 | | |
868 | 869 | | |
869 | | - | |
| 870 | + | |
870 | 871 | | |
871 | 872 | | |
| 873 | + | |
872 | 874 | | |
873 | 875 | | |
874 | 876 | | |
| |||
882 | 884 | | |
883 | 885 | | |
884 | 886 | | |
| 887 | + | |
885 | 888 | | |
886 | 889 | | |
887 | 890 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
700 | 700 | | |
701 | 701 | | |
702 | 702 | | |
| 703 | + | |
703 | 704 | | |
704 | 705 | | |
705 | 706 | | |
| |||
710 | 711 | | |
711 | 712 | | |
712 | 713 | | |
| 714 | + | |
713 | 715 | | |
714 | 716 | | |
715 | 717 | | |
| |||
723 | 725 | | |
724 | 726 | | |
725 | 727 | | |
| 728 | + | |
726 | 729 | | |
727 | 730 | | |
728 | 731 | | |
| 732 | + | |
| 733 | + | |
729 | 734 | | |
730 | 735 | | |
731 | 736 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
| 695 | + | |
695 | 696 | | |
696 | 697 | | |
697 | 698 | | |
| |||
702 | 703 | | |
703 | 704 | | |
704 | 705 | | |
| 706 | + | |
705 | 707 | | |
706 | 708 | | |
707 | 709 | | |
| |||
715 | 717 | | |
716 | 718 | | |
717 | 719 | | |
| 720 | + | |
718 | 721 | | |
719 | 722 | | |
720 | 723 | | |
| 724 | + | |
| 725 | + | |
721 | 726 | | |
722 | 727 | | |
723 | 728 | | |
| |||
0 commit comments