Refactor AddressSearch to be compatible with Form#7701
Refactor AddressSearch to be compatible with Form#7701marcochavezf merged 14 commits intoExpensify:mainfrom
Conversation
rushatgabhane
left a comment
There was a problem hiding this comment.
@kakajann two things -
-
Point 10 isn't implemented - Error text needs to be aligned with label and input value as show here - #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 |
src/components/AddressSearch.js
Outdated
| inputID: props.inputID, | ||
| shouldSaveDraft: props.shouldSaveDraft, | ||
| onBlur: props.onBlur, | ||
| onChange: (text) => { |
There was a problem hiding this comment.
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.
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
App/src/components/TextInput/BaseTextInput.js
Lines 121 to 128 in c049cc4
There was a problem hiding this comment.
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.
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.
@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.
|
Hmm I think that error is caused by a regression in |
|
@luacmartins Done |
luacmartins
left a comment
There was a problem hiding this comment.
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.
We renamed this util function to validateInputIDProps. Please update it.
Co-authored-by: Carlos Martins <luacmartins@gmail.com>
|
No problem @luacmartins |
luacmartins
left a comment
There was a problem hiding this comment.
LGTM! Thanks for all the changes @kakajann! @rushatgabhane and @marcochavezf all yours.
|
Thanks for the review @luacmartins 🙇 |
rushatgabhane
left a comment
There was a problem hiding this comment.
@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.
AdressSearchis usingTextInputDone.
Done.
Nothing to remove.
Fixed Issues
$ #7538
Tests
QA Steps
Nothing to test I guess. It's only refactor.
Tested On
Screenshots