-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[TS migration] Migrate TabSelector components to typescript #33084
Conversation
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.
LGTM!
}; | ||
|
||
const getIconAndTitle = (route, translate) => { | ||
function getIconAndTitle(route: string, translate: LocaleContextProps['translate']): {icon: FunctionComponent<SvgProps>; title: string} { |
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.
Let's create a separate type for return type {icon: FunctionComponent<SvgProps>; title: string}
navigation.navigate({name: route.name, merge: true}); | ||
navigation.navigate({key: route.key, merge: true}); |
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.
Could you clarify why this was changed?
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 previous usage wasn't interpreted by typescript properly, I would have to use
navigation.navigate({name: route.name, merge: true, params: {});
because params
is not optional in navigate function arguments. Thats why I switched to navigation.navigate({key: route.key, merge: true});
usage, because it does the same thing, but has optional params argument.
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.
LGTM
@alitoshmatov 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] |
Hi @alitoshmatov, could you please review this PR? 😁 |
Working on it |
Reviewer Checklist
Screenshots/VideosAndroid: Nativetabs-android.movAndroid: mWeb Chrometabs-mweb.moviOS: NativeiOS: mWeb Safaritabs-safari.mp4MacOS: Chrome / Safaritabs-web.movMacOS: Desktoptabs-desktop.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.
LGTM
We did not find an internal engineer to review this PR, trying to assign a random engineer to #25089 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
I got assigned the issue so I can review this |
/** Title of the tab */ | ||
title: PropTypes.string, | ||
title?: string; | ||
|
||
/** Animated opacity value while the label is inactive state */ |
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.
/** Animated opacity value while the label is inactive state */ | |
/** Animated opacity value while the label is in inactive state */ |
/** Icon to display on tab */ | ||
icon?: (props: SrcProps) => React.ReactNode; | ||
|
||
/** Animated opacity value while the label is inactive state */ |
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.
/** Animated opacity value while the label is inactive state */ | |
/** Animated opacity value while the icon is in inactive state */ |
/** Animated opacity value while the label is inactive state */ | ||
inactiveOpacity?: number | Animated.AnimatedInterpolation<number>; | ||
|
||
/** Animated opacity value while the label is in active state */ |
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.
/** Animated opacity value while the label is in active state */ | |
/** Animated opacity value while the icon is in active state */ |
|
||
/** Animated background color value for the tab button */ | ||
// eslint-disable-next-line | ||
backgroundColor: PropTypes.any, | ||
backgroundColor?: string | Animated.AnimatedInterpolation<string>; | ||
|
||
/** Animated opacity value while the label is inactive state */ |
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.
/** Animated opacity value while the label is inactive state */ | |
/** Animated opacity value while the tab is in inactive state */ |
|
||
/** Animated opacity value while the label is inactive state */ | ||
// eslint-disable-next-line | ||
inactiveOpacity: PropTypes.any, | ||
inactiveOpacity?: number | Animated.AnimatedInterpolation<number>; | ||
|
||
/** Animated opacity value while the label is in active state */ |
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.
/** Animated opacity value while the label is in active state */ | |
/** Animated opacity value while the tab is in active state */ |
|
||
/** Whether this tab is active */ | ||
isFocused: PropTypes.bool, | ||
isFocused?: boolean; |
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.
Should we call this isActive instead, since the comment says "Whether this tab is active", and the comments I'm suggesting changes on also use "active" and not "focused"?
isFocused?: boolean; | |
isActive?: boolean; |
@cead22 fixed the comments the way you requested 😃 |
@VickyStash @blazejkustra @alitoshmatov can one of you give this another look just in case I missed something. Thanks! |
Anyone? |
Working on it |
Everything looks good and working well Screen.Recording.2023-12-21.at.21.37.53.movSimulator.Screen.Recording.-.iPhone.15.Plus.-.2023-12-21.at.21.38.46.mp4 |
Thank you! |
✋ 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/cead22 in version: 1.4.17-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.17-8 🚀
|
Sorry, I was OOO. Thanks for quick merge! |
Details
Migration of 'TabSelector' to Typescript.
Fixed Issues
$ #25089
PROPOSAL: N/A
Tests
Offline tests
N/A
QA Steps
Verify that TabSelector component works properly in testing requesting money flow(changing request money options from distance request to manual request etc.). Also test main flows of the app(sending messages, logging, requesting money).
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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.mov
Android: mWeb Chrome
https://github.com/Expensify/App/assets/88395093/dbb680e5-320d-436f-818a-73d94e37f5e5iOS: Native
ios.mov
iOS: mWeb Safari
iosweb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov