-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Optimize post-expense search page transition with progressive rendering #86738
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
Merged
luacmartins
merged 17 commits into
Expensify:main
from
software-mansion-labs:korytko/perf/destination-visible
Apr 2, 2026
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b990576
perf: add static version of search components
JakubKorytko 937d611
fix: disappearing expense
JakubKorytko 1979352
add: pulsing view animation
JakubKorytko 12b3a5b
skip waitForWrites on submit expense flow
JakubKorytko 1967b52
add one-frame skeleton to static list
JakubKorytko c419a01
remove one-frame skeleton
JakubKorytko f605fdb
fix: ts, test, codex comment
JakubKorytko 3dcc3f9
Merge branch 'main' into korytko/perf/destination-visible
JakubKorytko dba5d5e
address staszekscp comments
JakubKorytko ec57427
polishing: get rid of absolute, perf opt
JakubKorytko f465376
address codex review
JakubKorytko 7dff25d
clear optimistic tracking
JakubKorytko 4fac654
narrow flow to navigate_to_search
JakubKorytko 29da0c0
Merge branch 'main' into korytko/perf/destination-visible
JakubKorytko 089416d
re-organize structure
JakubKorytko 8de401e
add few more comments to statics
JakubKorytko ab68eea
Merge remote-tracking branch 'origin/main' into korytko/perf/destinat…
JakubKorytko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| import React, {useEffect} from 'react'; | ||
| import type {StyleProp, ViewStyle} from 'react-native'; | ||
| import {View} from 'react-native'; | ||
| import Animated, {cancelAnimation, Easing, useAnimatedReaction, useAnimatedStyle, useSharedValue, withDelay, withRepeat, withSequence, withTiming} from 'react-native-reanimated'; | ||
| import type {AnimatedStyle, SharedValue} from 'react-native-reanimated'; | ||
| import shouldRenderOffscreen from '@libs/shouldRenderOffscreen'; | ||
| import CONST from '@src/CONST'; | ||
|
|
||
| const {FADE_OUT_DURATION, FADE_IN_DURATION, PAUSE_DURATION, RECOVERY_DURATION} = CONST.PULSE_ANIMATION; | ||
|
|
||
| const EASING_OUT = Easing.out(Easing.quad); | ||
| const EASING_IN = Easing.in(Easing.quad); | ||
|
|
||
| type PulsingViewProps = { | ||
| /** Whether the view should pulse */ | ||
| shouldPulse: boolean; | ||
|
|
||
| /** Content to render */ | ||
| children: React.ReactNode; | ||
|
|
||
| /** | ||
| * Array of style objects | ||
| * @default [] | ||
| */ | ||
| style?: StyleProp<AnimatedStyle<ViewStyle>>; | ||
|
|
||
| /** | ||
| * The minimum opacity reached during the pulse | ||
| * @default 0.5 | ||
| */ | ||
| minOpacity?: number; | ||
|
|
||
| /** Whether the view needs to be rendered offscreen (for Android only) */ | ||
| needsOffscreenAlphaCompositing?: boolean; | ||
|
|
||
| /** Style applied to a non-animated outer wrapper, useful for opaque backgrounds that shouldn't pulse */ | ||
| wrapperStyle?: StyleProp<ViewStyle>; | ||
| }; | ||
|
|
||
| function startPulse(opacity: SharedValue<number>, minOpacity: number) { | ||
| 'worklet'; | ||
|
|
||
| opacity.set( | ||
| withRepeat( | ||
| withSequence( | ||
| withTiming(minOpacity, {duration: FADE_OUT_DURATION, easing: EASING_OUT}), | ||
| withTiming(1, {duration: FADE_IN_DURATION, easing: EASING_IN}), | ||
| withDelay(PAUSE_DURATION, withTiming(1, {duration: 0})), | ||
| ), | ||
| -1, | ||
| false, | ||
| ), | ||
| ); | ||
| } | ||
|
|
||
| function stopPulse(opacity: SharedValue<number>) { | ||
| 'worklet'; | ||
|
|
||
| cancelAnimation(opacity); | ||
| opacity.set(withTiming(1, {duration: RECOVERY_DURATION, easing: EASING_OUT})); | ||
| } | ||
|
|
||
| function PulsingView({shouldPulse, children, style = [], minOpacity = 0.5, needsOffscreenAlphaCompositing = false, wrapperStyle}: PulsingViewProps) { | ||
| const shouldPulseShared = useSharedValue(shouldPulse); | ||
| useEffect(() => { | ||
| shouldPulseShared.set(shouldPulse); | ||
| }, [shouldPulse, shouldPulseShared]); | ||
|
|
||
| const minOpacityShared = useSharedValue(minOpacity); | ||
| useEffect(() => { | ||
| minOpacityShared.set(minOpacity); | ||
| }, [minOpacity, minOpacityShared]); | ||
|
|
||
| const opacity = useSharedValue(1); | ||
|
|
||
| useAnimatedReaction( | ||
| () => shouldPulseShared.get(), | ||
| (isPulsing, wasPulsing) => { | ||
| if (isPulsing === wasPulsing) { | ||
| return; | ||
| } | ||
|
|
||
| if (isPulsing) { | ||
| startPulse(opacity, minOpacityShared.get()); | ||
| } else { | ||
| stopPulse(opacity); | ||
| } | ||
| }, | ||
| ); | ||
|
|
||
| const animatedStyle = useAnimatedStyle(() => ({ | ||
| opacity: opacity.get(), | ||
| })); | ||
|
|
||
| const animatedContent = ( | ||
| <Animated.View | ||
| style={[animatedStyle, style]} | ||
| needsOffscreenAlphaCompositing={shouldRenderOffscreen ? needsOffscreenAlphaCompositing : undefined} | ||
| > | ||
| {children} | ||
| </Animated.View> | ||
| ); | ||
|
|
||
| if (wrapperStyle) { | ||
| return <View style={wrapperStyle}>{animatedContent}</View>; | ||
| } | ||
|
|
||
| return animatedContent; | ||
| } | ||
|
|
||
| export default PulsingView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/components/Search/SearchList/ListItem/TransactionListItem.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/components/Search/SearchList/ListItem/UserInfoAndActionButtonRow.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/components/Search/SearchPageHeader/SearchFiltersBarNarrow.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can
skipSkeletonbe a part ofSearchAutocompleteInputProps?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.
Unfortunately no -
SearchAutocompleteInputitself doesn't useskipSkeleton, so adding it toSearchAutocompleteInputPropstriggersreact/no-unused-prop-types. It's only consumed by the wrapper layer, so the intersection type is the correct approach here.