-
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
[No QA] [TS migration] Migrate 'getNavigationModalCardStyles' style to TypeScript #25923
[No QA] [TS migration] Migrate 'getNavigationModalCardStyles' style to TypeScript #25923
Conversation
@parasharrajat 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] |
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.
Approving to forward it to internal team.
We did not find an internal engineer to review this PR, trying to assign a random engineer to #24725 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
Before merge we also require an approval from @fabioh8010 |
type GetNavigationModalCardStylesParams = {isSmallScreenWidth: number}; | ||
type GetNavigationModalCardStylesKeys = 'position' | 'top' | 'right' | 'width' | 'backgroundColor' | 'height'; | ||
|
||
type GetNavigationModalCardStyles = ({isSmallScreenWidth}: GetNavigationModalCardStylesParams) => Merge<Pick<ViewStyle, GetNavigationModalCardStylesKeys>, Pick<CSSProperties, 'position'>>; |
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.
Hi @BartoszGrajdek , for this one I was going to suggest to relax the types a little bit, but I'm having this strange TS error.
// types.ts
import {CSSProperties} from 'react';
import {ViewStyle} from 'react-native';
type GetNavigationModalCardStylesParams = {isSmallScreenWidth: number};
type GetNavigationModalCardStyles = (params: GetNavigationModalCardStylesParams) => ViewStyle | CSSProperties;
export default GetNavigationModalCardStyles;
// index.website.ts
import getBaseNavigationModalCardStyles from './getBaseNavigationModalCardStyles';
import GetNavigationModalCardStyles from './types';
const getNavigationModalCardStyles: GetNavigationModalCardStyles = ({isSmallScreenWidth}) => ({
...getBaseNavigationModalCardStyles({isSmallScreenWidth}),
// position: fixed is set instead of position absolute to workaround Safari known issues of updating heights in DOM.
// Safari issues:
// https://github.com/Expensify/App/issues/12005
// https://github.com/Expensify/App/issues/17824
// https://github.com/Expensify/App/issues/20709
position: 'fixed',
});
export default getNavigationModalCardStyles;
Could you check if you have the same problem?
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.
I do not have this problem
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.
I'll make the types less complicated first, then we'll see if you still have this error
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 for the feedback @BartoszGrajdek. Do you agree with my suggestion?
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.
then we'll see if you still have this error
I think you don't need to worry about this, it's the second time today I had similar issue with TS where others not, is something in my machine.
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.
I think that's caused by position: 'fixed' which is confusing to TS
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.
Yes, or if you remove ...getBaseNavigationModalCardStyles({isSmallScreenWidth}),
also works. I honestly don't know why this is happening, if we don't have a solution for this error I would suggest to you to proceed with your typings.
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.
What do you think about this? @fabioh8010
import {CSSProperties} from 'react';
import {ViewStyle} from 'react-native';
import {Merge} from 'type-fest';
type GetNavigationModalCardStylesParams = {isSmallScreenWidth: number};
type GetNavigationModalCardStyles = ({isSmallScreenWidth}: GetNavigationModalCardStylesParams) => Merge<ViewStyle, Pick<CSSProperties, 'position'>>;
export default GetNavigationModalCardStyles;
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.
You can simplify the parameter
type GetNavigationModalCardStyles = (params: GetNavigationModalCardStylesParams) => Merge<ViewStyle, Pick<CSSProperties, 'position'>>;
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.
Ok, added these changes. It's simplified now
Reviewer Checklist
Screenshots/VideosWebMobile Web - ChromeMobile Web - SafariDesktopiOSAndroid |
✋ 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/MariaHCD in version: 1.3.58-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.58-5 🚀
|
🚀 Deployed to staging by https://github.com/MariaHCD in version: 1.3.59-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.59-5 🚀
|
Details
Migrate 'getNavigationModalCardStyles' style files to TypeScript
Fixed Issues
$ #24725
Tests
Offline tests
QA Steps
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)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)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
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android