[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] |
parasharrajat
left a comment
There was a problem hiding this comment.
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.
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.
I do not have this problem
There was a problem hiding this comment.
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.
Thanks for the feedback @BartoszGrajdek. Do you agree with my suggestion?
There was a problem hiding this comment.
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.
I think that's caused by position: 'fixed' which is confusing to TS
There was a problem hiding this comment.
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.
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.
You can simplify the parameter
type GetNavigationModalCardStyles = (params: GetNavigationModalCardStylesParams) => Merge<ViewStyle, Pick<CSSProperties, 'position'>>;There was a problem hiding this comment.
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 Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android