FaridSafi / react-native-google-places-autocomplete

Customizable Google Places autocomplete component for iOS and Android React-Native apps
MIT License
2k stars 851 forks source link

Add onSubmitEditingSelectFirst option #936

Open findhumane opened 6 months ago

findhumane commented 6 months ago

It's very common to want the first result to be virtually pressed when the input textbox is submitted. This adds a new boolean option onSubmitEditingSelectFirst to support this feature (default false).

If a user specifies textInputProps.onSubmitEditing and onSubmitEditingSelectFirst is set to true, then the first result is first pressed and then textInputProps.onSubmitEditing is executed. Note that onPress is evaluated asynchronously, so textInputProps.onSubmitEditing should not assume that the result of onPress is finished when textInputProps.onSubmitEditing is called.

Example:

<GooglePlacesAutocomplete
  onSubmitEditingSelectFirst={true}
joaqo commented 2 months ago

This is great, why is it not merged?