-
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
17548: Personal details push to page #18424
Conversation
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
@@ -48,6 +48,10 @@ const propTypes = { | |||
/** A callback function when the value of this field has changed */ | |||
onInputChange: PropTypes.func.isRequired, | |||
|
|||
onCountryChange: PropTypes.func, |
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.
Add a comment explaining this function
@@ -48,6 +48,10 @@ const propTypes = { | |||
/** A callback function when the value of this field has changed */ | |||
onInputChange: PropTypes.func.isRequired, | |||
|
|||
onCountryChange: PropTypes.func, | |||
|
|||
onStateChange: PropTypes.func, |
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.
Same here
|
||
)} | ||
<FormSpace /> | ||
|
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.
maxLength={CONST.FORM_CHARACTER_LIMIT} | ||
/> | ||
<FormSpace /> | ||
|
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.
</View> | ||
<View style={styles.mb4}> | ||
) : ( | ||
|
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.
src/pages/CountrySelectorPage.js
Outdated
return _.filter(countries, country => country.text.toLowerCase().includes(searchValue.toLowerCase())); | ||
} | ||
|
||
function CountrySelectorPage(props) { |
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.
DRY, This file has a lot of similarities with the StateSelectorPage
component. Could you consider refactoring this code to create more reusable components that can be shared across multiple files?
src/libs/actions/PersonalDetails.js
Outdated
@@ -96,6 +96,14 @@ function getCountryISO(countryName) { | |||
return _.findKey(CONST.ALL_COUNTRIES, country => country === countryName) || ''; | |||
} | |||
|
|||
function getCountryNameBy(countryISO) { |
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.
function getCountryNameBy(countryISO) { | |
/** | |
* Returns the name of the country associated with the provided ISO code. | |
* If the provided code is invalid, an empty string is returned. | |
* | |
* @param {string} countryISO The ISO code of the country to look up. | |
* @returns {string} The name of the country associated with the provided ISO code. | |
*/ | |
function getCountryNameBy(countryISO) { |
@@ -52,23 +52,41 @@ const defaultProps = { | |||
}, | |||
}; | |||
|
|||
function FormSpace() { |
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.
Consider encapsulating FormSpace in the AddressPage, as it is only used in one component.
Or just use <View style={styles.formSpaceVertical} />
instead.
src/components/StatePicker.js
Outdated
Navigation.navigate(ROUTES.getUsaStateSelectionRoute(stateTitle || stateISO, Navigation.getActiveRoute())); | ||
}, [stateTitle, stateISO]); | ||
|
||
const title = useMemo(() => { |
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 memoization is not needed here
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 propose to write a separate function for that
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.
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.
But this is a string type, which shouldn't cause a re-render in case the title stays the same without using useMemo, that because I requested removing that because it's a cheap function. and it is no matter of the render count
src/components/StatePicker.js
Outdated
const navigation = props.navigation; | ||
const onInputChange = props.onInputChange; | ||
const defaultValue = props.defaultValue; | ||
const translate = props.translate; |
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.
Too many unnecessary declarations here, to improve readability please destruct props in component or call functions with just a simple approach props.navigation.navigate(...)
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.
Yeah, I talked internally about this but seems that we aren't gonna do destruction, but probably we can bring it back in discussion
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.
This topic is mainly about defaultProps
with destructing, but let's leave destructing until that is clarified.
I propose to use simple syntax props.navigation.navigate
to reduce variable declaration, which will improve the hook's readability right now, it looks a bit messy
Except for minor improvements that the guidelines are in the process of clarifying. Overall, LGTM 👌 |
@cristipaval @mananjadhav 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] |
@best-lucky1030 No, is ready for Expensify review |
@venture1981 all solved |
bump @mananjadhav |
Taking longer than expected, reviewed half the files, reviewing the other half and will test it as well. |
I reviewed and I am fine with the changes, but I see an outstanding comment on making it DRY - StateSelector and CountrySelector. Are we looking to fix this right now ? or follow up in another PR. |
I just thought now that it would be great if @shawnborton has some time to review this from the design standpoint 🙏 |
@mananjadhav that change is done, both components are using |
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.
OptionsSelector
already supports search. Why can't we reuse that component?
PronounsPage
is a good example. I don't see major UI difference between country/state selector pages and pronouns page.
Also let's implement what pronouns page does:
- pre-populate search input and auto-scroll to selected item
- deselect support
- trim search
bug1.mov
I think we should still support bug3.mov |
Show state name here, not code. bug4.mov |
I agree, that does not look great. I agree that the hover styles should match full width like places in the app. |
For these push-to-page rows, are we using a global component? I was surprised to see that the label font size is smaller when there is no value: For that "emtpy state" of the push row when there is no value set, the font size should be 15px. Can we make sure that is the case for all of these rows, everywhere? cc @cristipaval Then once a value is set, the label size goes to 13px and it rests above the value, which is at 15px. |
For the list selection views, @cristipaval where do we stand with updating the styles there? we shouldn't have the lines go edge-to-edge, and I thought we had an issue open to make sure the list selection is consistent everywhere. |
This is already happening on production. Maybe we can create a separate GH to handle that. |
@cristipaval @0xmiroslav Conflicts solved |
|
||
export {greenCheckmark}; | ||
|
||
export default withLocalize(CountrySelectorPage); |
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 component name is wrong. Should be aligned with file name.
|
||
const greenCheckmark = {src: Expensicons.Checkmark, color: themeColors.success}; | ||
|
||
function filterOptions(searchValue, countries) { |
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.
As this is general component, replace all specific names with general ones. i.e. countries -> data
function filterOptions(searchValue, countries) { | |
function filterOptions(searchValue, data) { |
@gedu I noticed recent commits are not signed. All commits in the PR should be signed to pass checks. |
a233ce1
to
a13e904
Compare
@0xmiroslav I'm having some issues trying to sign previous commits, I tried many commands also some shared into slack but no luck. can I create a new PR? what do you think? |
@gedu we don't recommend force-push once review started but try only this time |
@0xmiroslav what do you mean by a force-push? That won't sign the old commits, there are 3 commits that need to be signed, I could sign one of the last ones but those that are from May are getting hard |
Maybe you can push all of work so far in one commit. You're about to do this in new PR, right? |
Yeah, I will create a new PR, because one of the unsigned commits is from May, and rebasing is really complicated |
force-push doesn't require rebasing. You can do in this branch as if you do in a new branch
|
Wanna keep same PR just to have long convo history so far. i.e. important discussions about design |
8e925bc
to
1cfa2ba
Compare
@0xmiroslav pushed, sorry for the inconvenience, my main Mac is broken so using my backup Mac I forgot to sign the commits |
@0xmiroslav any updates? |
@0xmiroslav is something that I can help with to get this PR to merge? |
Sorry I will review this today. Please pull main. |
1c164df
to
b2e31bd
Compare
This was not addressed yet |
BUG: weird transition animation (the entire page flickers) bug1.mov |
BUG: after saving state, country is reverted bug2.mov |
BUG: after selecting address from auto-complete menu,
bug4.mov |
@gedu please compare with staging and fix all differences other than push-to-page features. |
64d43f0
to
c3f057e
Compare
71f9366
to
b997868
Compare
Details
Updated dropdowns fields to be MenuItems which sends the user to another page to pick the option
Standarized the spaces between Inputs, created a new FormSpace component.
Fixed Issues
$ #17548
PROPOSAL: #17548 (comment)
Tests
Errors on Empty State
Update the menu Country item (no USA)
Update the menu Country item (USA)
Update the menu State item (USA)
Autocomplete address
Offline tests
Errors on Empty State
Update the menu Country item (no USA)
Update the menu Country item (USA)
Update the menu State item (USA)
QA Steps
Errors on Empty State
Update the menu Country item (no USA)
Update the menu Country item (USA)
Update the menu State item (USA)
Autocomplete address
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
pushPage_safari.mp4
pusgPage_chrome.mp4
pushPage_safariError.mp4
Mobile Web - Chrome
pusgPage_chromeMobile.mp4
Mobile Web - Safari
pushPage_safariMobile.mp4
Desktop
pushPage_desktop.mp4
iOS
pushPage_ios.mp4
Android
pushPage_android.mp4