-
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
[TS migration] Migrate 'AmountTextInput' component to TypeScript #33955
[TS migration] Migrate 'AmountTextInput' component to TypeScript #33955
Conversation
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
src/components/AmountTextInput.tsx
Outdated
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import CONST from '@src/CONST'; | ||
import type TextInputSelection from '@src/types/utils/TextInputSelection'; | ||
import TextInputComponent from './TextInput'; |
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.
import TextInputComponent from './TextInput'; | |
import TextInput from './TextInput'; |
src/components/AmountTextInput.tsx
Outdated
@@ -0,0 +1,74 @@ | |||
import type {ForwardedRef} from 'react'; | |||
import React from 'react'; | |||
import type {StyleProp, TextInput, TextStyle, ViewStyle} from 'react-native'; |
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.
import type {StyleProp, TextInput, TextStyle, ViewStyle} from 'react-native'; | |
import type {StyleProp, TextInput as TextInputRN, TextStyle, ViewStyle} from 'react-native'; |
src/components/AmountTextInput.tsx
Outdated
formattedAmount: string; | ||
|
||
/** A ref to forward to amount text input */ | ||
forwardedRef?: ForwardedRef<TextInput>; |
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.
Remove forwardedRef
and instead add a second argument to AmountTextInput component (check out how it's done in TextInput)
src/components/AmountTextInput.tsx
Outdated
|
||
function AmountTextInput({ | ||
formattedAmount, | ||
forwardedRef = undefined, |
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.
No need for undefined default values, same for {} and () => {} (instead use ?. and ?? operators)
@@ -0,0 +1,6 @@ | |||
type TextInputSelection = { |
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 leave it in src/libs/ComposerUtils/index.ts
and export it from there instead
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.
Aside from Błażej's comments, LGTM!
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!
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeamountAndroidNative-compressed.mp4iOS: NativeamountTSiOSNative.mp4iOS: mWeb SafariamountTSiOSSafari.mp4MacOS: Chrome / SafariamountTSChrome.mp4MacOS: DesktopamountTSDesktop.mp4 |
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 #24999 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
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! Nice job!
✋ 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/blimpich in version: 1.4.23-0 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.4.23-4 🚀
|
Details
Migration of
AmountTextInput
to Typescript.Fixed Issues
$ #24999
PROPOSAL: N/A
Tests
Offline tests
N/A
QA Steps
Same as tests
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(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label 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
Screen.Recording.2024-01-05.at.10.52.16.mov
Android: mWeb Chrome
Screen.Recording.2024-01-05.at.11.01.21.mov
iOS: Native
Screen.Recording.2024-01-05.at.10.31.29.mov
iOS: mWeb Safari
Screen.Recording.2024-01-05.at.10.41.27.mov
MacOS: Chrome / Safari
Screen.Recording.2024-01-05.at.10.37.10.mov
MacOS: Desktop
Screen.Recording.2024-01-05.at.10.47.36.mov