Migrate Forms into NewContactMethodPage #18223
Conversation
|
@cristipaval @mollfpr One of you needs to 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] |
|
hey @mollfpr @cristipaval We are adding a few validation texts here do we need someone to translate for us should I ask in Slack? en.js -> es.js -> |
mollfpr
left a comment
There was a problem hiding this comment.
@dhairyasenjaliya Thanks for the quick PR!
A couple of request changes, and for the email/phone input, we should add shouldSaveDraft.
Saving draft values is highly desirable, and we should always try to save draft values. Additionally, we should clear draft data once the form is successfully submitted by calling
Onyx.set(ONYXKEY.FORM_ID, null)in the onSubmit callback passed to Form.
For the copy, we can get it faster from the Slack channel.
| inputID="phoneOrEmail" | ||
| autoCapitalize="none" | ||
| returnKeyType={Permissions.canUsePasswordlessLogins(props.betas) ? 'done' : 'next'} | ||
| autoFocus |
There was a problem hiding this comment.
I think it's better to use the previous implementation to focus on the input with onTransitionEnd. With this I found it's a bit weird transition with iOS and on Android sometimes the keyboard is not open even the input is focused.
iOS
Simulator.Screen.Recording.-.iPhone.14.-.2023-05-02.at.18.14.28.mp4
Android
Screen.Recording.2023-05-02.at.18.15.45.mov
There was a problem hiding this comment.
alright let me quick check this one to use onEntryTransitionEnd
There was a problem hiding this comment.
@mollfpr not sure why but I'm not getting ref event on <TextInput>
hm, do you suggest adding |
Yes! |
@mollfpr also where do we need to clear this |
|
@dhairyasenjaliya Could you check if the old input value is not cleared after the form submit success? Also, could you resolve that conflict? Thanks! |
|
@mollfpr all query resolve let me know if any further improvement required :) |
|
@dhairyasenjaliya Thanks! Another conflict need to solved 😅 |
|
@mollfpr oop lots of things going on this page 😄 btw Im waiting for translation text do we tag someone ? |
|
@dhairyasenjaliya I don't know too 😅 @cristipaval can add the label |
|
@mollfpr Yeah, we can do that also conflict is resolved & I think PR is ready for merge just waiting for the translation text |
|
@dhairyasenjaliya Could you please merge the latest main? |
|
@cristipaval Sure btw we are just waiting for translation messages |
|
@cristipaval conflict resolved do we bump anyone about translating messages? this is only left here |
|
@mollfpr @cristipaval all translation messages updated as per suggestion and conflict resolved we should merge this |
|
Bump @mollfpr |
Reviewer Checklist
Screenshots/VideosWeb18223.Web.movMobile Web - Chrome18223.mWeb.Chrome.movMobile Web - Safari18223.mWeb.Safari.mp4Desktop18223.Desktop.moviOS18223.iOS.mp4AndroidScreen.Recording.2023-05-12.at.14.44.31.mov |
|
I'm running out of time to record the test. I'll try to finish it in the morning. |
|
@mollfpr When you get a chance let's complete this before fixing another conflict 😄 |
|
Sorry for the delay @dhairyasenjaliya! The code looks good to me, I just need a record for the Android. Could you update the test to include the expected is? Like add one more point Verify that the error display The Entered Contact Method already exists. |
|
@mollfpr added |
|
Completed the checklist! All yours @cristipaval |
|
✋ 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/cristipaval in version: 1.3.14-0 🚀
|
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.3.14-14 🚀
|
|
|
||
| return (Permissions.canUsePasswordlessLogins(props.betas) || password) && (Str.isValidEmail(login) || parsePhoneNumber(phoneLogin).possible); | ||
| }, [login, password, props.betas]); | ||
| const validate = (values) => { |
There was a problem hiding this comment.
Coming from #20610:
This was overlooked while doing form refactor.
validate is re-triggered when form is submitted and it caused a small regression: email already exist message appears for a second when go to previous screen.
More details about the root cause: #20610 (comment)
useCallback and original dependencies were added in https://github.com/Expensify/App/pull/17472/files#diff-fe6782071280d20a06400ddd9435c11ea1961b6d8601c9acdc1e42257ad52348R84 and we should have considered this while introducing form and removing useCallback.
| const validateNumber = (values) => { | ||
| const parsedPhoneNumber = parsePhoneNumber(values); | ||
|
|
||
| if (parsedPhoneNumber.possible) { |
There was a problem hiding this comment.
This line caused a regression in #22819, parsePhoneNumber will treat 1234567890@ as a valid phone number. more context #22819 (comment)


Details
Fixed Issues
$ #17997
PROPOSAL: #17997 (comment)
Tests
Offline tests
Same as above
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