-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Migrate last components to reanimated #55202
Migrate last components to reanimated #55202
Conversation
…nunarrow_and_daseoverlat_to_reanimated_II # Conflicts: # src/components/TabSelector/TabSelectorItem.tsx # src/pages/Search/SearchTypeMenuNarrow.tsx
…, migrate base overly
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.
Awesome work, LGTM
@shubham1206agra 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] |
Is there anything here that needs to be reviewed by the design team? |
@shawnborton There are no user-visible changes here. It's just the completion of the optimization that removes animated and replaces it with reanimated. The only noticeable change might be performance improvements. |
Sounds good, thanks for confirming! |
/* Callback to close the modal */ | ||
onPress?: () => void; | ||
|
||
/* Returns whether a modal is displayed on the left side of the screen. By default, the modal is displayed on the right */ | ||
isModalOnTheLeft?: boolean; | ||
}; | ||
|
||
function BaseOverlay({shouldUseNativeStyles, onPress, isModalOnTheLeft = false}: BaseOverlayProps) { | ||
function BaseOverlay({onPress, isModalOnTheLeft = false}: BaseOverlayProps) { | ||
const styles = useThemeStyles(); | ||
const {current} = useCardAnimation(); | ||
const {translate} = useLocalize(); | ||
|
||
return ( | ||
<Animated.View |
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.
@sumo-slonik Is there a reason why this component is not being migrated to Reanimated?
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.
BaseOverlay also utilizes react-navigation but in this case, it involves the import:
import { useCardAnimation } from '@react-navigation/stack';
Later, we use useCardAnimation to create opacity in the styles for Animated.View to obtain the animation progress like this:
opacity: current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, variables.overlayOpacity],
extrapolate: 'clamp',
}),
Due to this integration with react-navigation, migrating this component to Reanimated is not possible.
The useReanimatedTransitionProgress()
from react-native-screens
could potentially address the issue on native platforms. However, on those platforms, this component appears as follows:
function Overlay() {
return null;
}
Overlay.displayName = 'Overlay';
export default Overlay;
, so migration is not necessary.
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.
@mountiny Do you agree with this? Asking for confirmation.
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.
the explanation sounds good to me
@sumo-slonik Can you resolve conflicts here? |
…ng-to_reanimated # Conflicts: # src/components/TabSelector/TabSelectorItem.tsx
Conflicts resolved. |
@shubham1206agra thanks for the review, can you please complete the testing now? thank you! |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2025-01-22.at.4.13.19.PM.movMacOS: DesktopScreen.Recording.2025-01-22.at.4.16.18.PM.mov |
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.
Thanks!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.89-0 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.89-8 🚀
|
Explanation of Change
Migration of the latest components from animated to reanimated, adding a rule to the linter that blocks animated imports, adding examples of how to create animation code with reanimated, and adding exceptions to the linter in places where migration is not possible due to external libraries being used.
Fixed Issues
$ #52920
Tests
There are no visible changes in the GUI, but you can follow this procedure:
Offline tests
No needed
QA Steps
Same as test.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
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
Screen.Recording.2025-01-14.at.15.24.04.mov
MacOS: Desktop
Screen.Recording.2025-01-14.at.15.37.40.mov