react-native-google-places-autocomplete icon indicating copy to clipboard operation
react-native-google-places-autocomplete copied to clipboard

feat add `loadOnMount` prop

Open jamesbechet opened this issue 4 years ago • 4 comments

What's in this PR?

This PR adds the loadOnMount prop to enable or disable loading the default value's search results after the view has been rendered, which is true by default.

jamesbechet avatar Sep 17 '21 15:09 jamesbechet

I'm not grasping the problem you are trying to solve here. Would you mind giving me a little more context here?

bell-steven avatar Sep 17 '21 15:09 bell-steven

Here's an example:

  • The customer has an address saved in the DB
  • The page loads, the props.value is set to 1 Montgomery street for example (address line 1)
  • The customer doesn't necessarily want to change it. Therefore, you don't need to load the default search results.
  • In addition, this also triggers props.onChangeText on mount, which is not the desired behavior in my case:
    • https://github.com/FaridSafi/react-native-google-places-autocomplete/blob/531261700e30e494d70db1dcf0b197a212eede04/GooglePlacesAutocomplete.js#L557-L565 - https://github.com/FaridSafi/react-native-google-places-autocomplete/blob/531261700e30e494d70db1dcf0b197a212eede04/GooglePlacesAutocomplete.js#L148-L150

Please let me know if you need more information.

jamesbechet avatar Sep 18 '21 03:09 jamesbechet

@bell-steven any updates on that?

jamesbechet avatar Nov 18 '21 18:11 jamesbechet

I don't have the time to test this thoroughly atm. I would recommend using patch-package in the interim.

bell-steven avatar Nov 18 '21 18:11 bell-steven