From 4c9885f654a3d0fc82b2899675c039dd3a924216 Mon Sep 17 00:00:00 2001 From: Hannu Lyytikainen Date: Wed, 22 Aug 2018 11:21:36 +0300 Subject: [PATCH 1/2] Add a prop for disabling default predictions --- .../LocationAutocompleteInputImpl.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/LocationAutocompleteInput/LocationAutocompleteInputImpl.js b/src/components/LocationAutocompleteInput/LocationAutocompleteInputImpl.js index fb104561f6..96e9a29629 100644 --- a/src/components/LocationAutocompleteInput/LocationAutocompleteInputImpl.js +++ b/src/components/LocationAutocompleteInput/LocationAutocompleteInputImpl.js @@ -181,9 +181,11 @@ class LocationAutocompleteInputImpl extends Component { currentPredictions() { const { search, predictions: fetchedPredictions } = currentValue(this.props); + const { useDefaultPredictions } = this.props; const hasFetchedPredictions = fetchedPredictions && fetchedPredictions.length > 0; + const showDefaultPredictions = !search && !hasFetchedPredictions && useDefaultPredictions; - return !search && !hasFetchedPredictions ? defaultPredictions : fetchedPredictions; + return showDefaultPredictions ? defaultPredictions : fetchedPredictions; } // Interpret input key event @@ -487,6 +489,7 @@ LocationAutocompleteInputImpl.defaultProps = { predictionsAttributionClassName: null, validClassName: null, placeholder: '', + useDefaultPredictions: true, meta: null, inputRef: null, }; @@ -502,6 +505,7 @@ LocationAutocompleteInputImpl.propTypes = { predictionsAttributionClassName: string, validClassName: string, placeholder: string, + useDefaultPredictions: bool, input: shape({ name: string.isRequired, value: oneOfType([ From d4d4ac90fa7f01c0578d300370823f597f5a856f Mon Sep 17 00:00:00 2001 From: Hannu Lyytikainen Date: Wed, 22 Aug 2018 11:25:42 +0300 Subject: [PATCH 2/2] Disable default predictions in listing wizard --- src/forms/EditListingLocationForm/EditListingLocationForm.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/forms/EditListingLocationForm/EditListingLocationForm.js b/src/forms/EditListingLocationForm/EditListingLocationForm.js index 078605791f..295269f2a6 100644 --- a/src/forms/EditListingLocationForm/EditListingLocationForm.js +++ b/src/forms/EditListingLocationForm/EditListingLocationForm.js @@ -72,6 +72,7 @@ export const EditListingLocationFormComponent = props => ( name="location" label={titleRequiredMessage} placeholder={addressPlaceholderMessage} + useDefaultPredictions={false} format={null} valueFromForm={values.location} validate={composeValidators(