fix: Category toggle visually switches while scrolling#83050
fix: Category toggle visually switches while scrolling#83050paulnjs wants to merge 5 commits intoExpensify:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 78ad34ea1e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| disabledAction?.(); | ||
| return; | ||
| } | ||
| hasUserToggled.current = true; |
There was a problem hiding this comment.
Reset user-toggle flag when toggle is rejected
hasUserToggled.current is set before onToggle runs, but it is only cleared later when isOn actually changes in useLayoutEffect. In flows where onToggle intentionally exits without changing state (for example, category toggles that show a modal and return when trying to disable the last enabled category), this flag stays true and the next recycled isOn prop change is misclassified as a user action, so the switch animates during scroll again. This reintroduces the visual glitch the commit is trying to prevent.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This indeed might cause regression. Can you check?
Example case:
Screen.Recording.2026-02-22.at.11.22.54.PM.mov
JmillsExpensify
left a comment
There was a problem hiding this comment.
Product behavior looks good in this PR.
Explanation of Change
Fixed Issues
$#79863
PROPOSAL:#79863 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android.mov
Android: mWeb Chrome
android_ch.mov
iOS: Native
ios.mov
iOS: mWeb Safari
ios_sfr.mov
MacOS: Chrome / Safari
chorme.mov