Skip to content

Commit

Permalink
Merge pull request Expensify#18258 from Pujan92/fix/16367
Browse files Browse the repository at this point in the history
Fix: Address field shows previous set of results on typing any char after removing the previous text
  • Loading branch information
flodnv authored May 3, 2023
2 parents 200ca85 + 01340b4 commit 234be3f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/AddressSearch/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'underscore';
import React, {useRef, useState} from 'react';
import React, {useMemo, useRef, useState} from 'react';
import PropTypes from 'prop-types';
import {LogBox, ScrollView, View} from 'react-native';
import {GooglePlacesAutocomplete} from 'react-native-google-places-autocomplete';
Expand Down Expand Up @@ -94,10 +94,11 @@ const defaultProps = {
const AddressSearch = (props) => {
const [displayListViewBorder, setDisplayListViewBorder] = useState(false);
const containerRef = useRef();
const query = {language: props.preferredLocale, types: 'address'};
if (props.isLimitedToUSA) {
query.components = 'country:us';
}
const query = useMemo(() => ({
language: props.preferredLocale,
types: 'address',
components: props.isLimitedToUSA ? 'country:us' : undefined,
}), [props.preferredLocale, props.isLimitedToUSA]);

const saveLocationDetails = (autocompleteData, details) => {
const addressComponents = details.address_components;
Expand Down

0 comments on commit 234be3f

Please sign in to comment.