From 08f3d3bf01b05ac0d47830c0c070fb57a22fd56e Mon Sep 17 00:00:00 2001 From: neil-marcellini Date: Mon, 4 Sep 2023 08:48:09 -0700 Subject: [PATCH 1/2] Show suggestions for places --- src/components/AddressSearch/index.js | 8 ++++++-- src/pages/iou/WaypointEditor.js | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/AddressSearch/index.js b/src/components/AddressSearch/index.js index e761ebeed26b..1697dddba805 100644 --- a/src/components/AddressSearch/index.js +++ b/src/components/AddressSearch/index.js @@ -95,6 +95,9 @@ const propTypes = { /** Maximum number of characters allowed in search input */ maxInputLength: PropTypes.number, + /** The result types to return from the Google Places Autocomplete request */ + resultTypes: PropTypes.string, + /** Information about the network */ network: networkPropTypes.isRequired, @@ -123,6 +126,7 @@ const defaultProps = { }, maxInputLength: undefined, predefinedPlaces: [], + resultTypes: 'address', }; // Do not convert to class component! It's been tried before and presents more challenges than it's worth. @@ -134,10 +138,10 @@ function AddressSearch(props) { const query = useMemo( () => ({ language: props.preferredLocale, - types: 'address', + types: props.resultTypes, components: props.isLimitedToUSA ? 'country:us' : undefined, }), - [props.preferredLocale, props.isLimitedToUSA], + [props.preferredLocale, props.resultTypes, props.isLimitedToUSA], ); const saveLocationDetails = (autocompleteData, details) => { diff --git a/src/pages/iou/WaypointEditor.js b/src/pages/iou/WaypointEditor.js index 8c168a456210..6f7a8f5d08d5 100644 --- a/src/pages/iou/WaypointEditor.js +++ b/src/pages/iou/WaypointEditor.js @@ -222,6 +222,7 @@ function WaypointEditor({transactionID, route: {params: {iouType = '', waypointI state: null, }} predefinedPlaces={recentWaypoints} + resultTypes='' /> From 89598d8793b5db05488a1358c1fd13d6da73fe1f Mon Sep 17 00:00:00 2001 From: neil-marcellini Date: Mon, 4 Sep 2023 09:14:49 -0700 Subject: [PATCH 2/2] Fix lint --- src/pages/iou/WaypointEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/WaypointEditor.js b/src/pages/iou/WaypointEditor.js index 6f7a8f5d08d5..68e85a34746d 100644 --- a/src/pages/iou/WaypointEditor.js +++ b/src/pages/iou/WaypointEditor.js @@ -222,7 +222,7 @@ function WaypointEditor({transactionID, route: {params: {iouType = '', waypointI state: null, }} predefinedPlaces={recentWaypoints} - resultTypes='' + resultTypes="" />