-
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
Refactor AddressSearch to be compatible with Form #7701
Refactor AddressSearch to be compatible with Form #7701
Conversation
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.
@kakajann two things -
-
Point 10 isn't implemented - Error text needs to be aligned with label and input value as show here - [HOLD for payment 2022-03-17] Refactor AddressSearch to be compatible with Form #7538 (comment)
I'll take a look at this soon.
As I mentioned above, Also, this PR covers the error alignment: https://github.com/Expensify/App/pull/7627/files Do you still want me to modify error alignment? |
is fixed |
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/components/AddressSearch.js
Outdated
inputID: props.inputID, | ||
shouldSaveDraft: props.shouldSaveDraft, | ||
onBlur: props.onBlur, | ||
onChange: (text) => { |
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.
Maybe I'm wrong, but I believe that onChanteText
passes the text value as argument vs onChange
passes an event. We should make sure that we are passing the text value 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 think it returns only text value, considering AddressSearch
is using TextInput
as the base component.
App/src/components/TextInput/BaseTextInput.js
Line 240 in c049cc4
onChangeText={this.setValue} |
App/src/components/TextInput/BaseTextInput.js
Lines 121 to 128 in c049cc4
setValue(value) { | |
if (this.props.onChange) { | |
this.props.onChange(value); | |
} | |
this.value = value; | |
Str.result(this.props.onChangeText, value); | |
this.activateLabel(); | |
} |
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.
Hmm that is onChangeText
though, not onChange
. I tried logging the text value here and I see the following:
Is that what we expect?
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 don't think so.
Should I push this diff?
diff --git a/src/components/AddressSearch.js b/src/components/AddressSearch.js
index 005438f75..bee2e40cb 100644
--- a/src/components/AddressSearch.js
+++ b/src/components/AddressSearch.js
@@ -158,7 +158,7 @@ const AddressSearch = (props) => {
inputID: props.inputID,
shouldSaveDraft: props.shouldSaveDraft,
onBlur: props.onBlur,
- onChange: (text) => {
+ onChangeText: (text) => {
if (skippedFirstOnChangeTextRef.current) {
props.onChange({street: text});
} else {
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.
@kakajann Sorry for the late reply, I was ooo for most of last week. I think it's fine to keep onChangeText
as we had before. The onChange
handler will be passed by the parent Form component.
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.
@luacmartins, done
Hmm I think that error is caused by a regression in |
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.
@luacmartins Done |
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.
Sorry for all the back and forth. Left a few more comments.
src/components/AddressSearch.js
Outdated
* @param {Object} props - props passed to the input | ||
* @returns {Object} - returns an Error object if isFormInput is supplied but inputID is falsey or not a string | ||
*/ | ||
inputID: props => FormUtils.getInputIDPropTypes(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.
We renamed this util function to validateInputIDProps
. Please update it.
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.
Done
Co-authored-by: Carlos Martins <luacmartins@gmail.com>
No problem @luacmartins |
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! Thanks for all the changes @kakajann! @rushatgabhane and @marcochavezf all yours.
Thanks for the review @luacmartins 🙇 |
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.
@kakajann could you please merge main
into your branch.
@marcochavezf LGTM! 🎉️
Tests well, and I gave this a run after merging main
from upstream.
@rushatgabhane Done |
✋ 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 @marcochavezf in version: 1.1.41-0 🚀
|
🚀 Deployed to staging by @marcochavezf in version: 1.1.41-0 🚀
|
🚀 Deployed to production by @francoisl in version: 1.1.41-6 🚀
|
Details
Done.
It was already optional.
Done.
There was no hasError prop.
Done.
I don't think it's my concern.
AdressSearch
is usingTextInput
Done.
Done.
Nothing to remove.
Fixed Issues
$ #7538
Tests
QA Steps
Nothing to test I guess. It's only refactor.
Tested On
Screenshots