From 93f900bb6d33e7a819128879b442ad7766183c5d Mon Sep 17 00:00:00 2001 From: Jack Singer <54961512+HomemadeToast57@users.noreply.github.com> Date: Tue, 19 Jul 2022 00:49:25 -0500 Subject: [PATCH] Added method setAddressTextAndQuery This new method has one address parameter. It changes the address text to the provided address and then queries the input. Using _handleChangeText(address) and setListViewDisplayed(true), it also shows the list of results automatically. This gives more flexibility to developers who would like to autofill and query input programmatically. --- GooglePlacesAutocomplete.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GooglePlacesAutocomplete.js b/GooglePlacesAutocomplete.js index cd032535..d94ad7ae 100644 --- a/GooglePlacesAutocomplete.js +++ b/GooglePlacesAutocomplete.js @@ -160,6 +160,10 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => { setAddressText: (address) => { setStateText(address); }, + setAddressTextAndQuery: (address) => { + _handleChangeText(address); ++ setListViewDisplayed(true); + }, getAddressText: () => stateText, blur: () => inputRef.current.blur(), focus: () => inputRef.current.focus(),