-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Optimize useAnimatedHighlightStyle to reduce unnecessary recalculations #62285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize useAnimatedHighlightStyle to reduce unnecessary recalculations #62285
Conversation
@rushatgabhane Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
🚧 @mountiny has triggered a test app build. You can view the workflow run here. |
Reviewer Checklist
Screenshots/VideosAndroid: mWeb ChromeiOS: HybridAppScreen.Recording.2025-05-20.at.13.27.22.movMacOS: Desktop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OlimpiaZurek bug on web -
not reproducible on ios
- submit two expenses to workspace
- go the grouped expense
- bug: you cannot see the table view which lists the expenses

🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
3f13e7d
to
fba4660
Compare
@rushatgabhane Fixed the issue by removing the unnecessary _WORKLET guard. It turns out this guard isn’t needed because we use . |
fba4660
to
bb2e1d4
Compare
@rushatgabhane ready for another look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
🚀 Deployed to staging by https://github.com/mountiny in version: 9.1.48-0 🚀
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.1.48-0 🚀
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.1.49-5 🚀
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.1.50-0 🚀
|
Explanation of Change
Problem
When switching tabs and navigating to the Reports page, the screen renders a
SearchList
component, which in turn renders multipleTransactionListItem
components. EachTransactionListItem
uses theuseAnimatedHighlightStyle
hook to animate highlight styles. However, profiling revealed that this hook was causing 3–4 unnecessary recalculations per render, even when the inputs didn’t change. These redundant invocations contributed to performance issues, especially when rendering large lists.Solution
To reduce unnecessary computations and improve performance, we optimized the useAnimatedStyle usage inside the hook by:
Before:
After:

Fixed Issues
$ #60007
PROPOSAL:
Tests
This is a performance optimization only, so no functional or UI changes are expected. No additional manual testing steps are required beyond verifying that the app behaves normally and that no regressions occur.
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectioncanBeMissing
param foruseOnyx
toggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop