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

Not able to restrict the search suggestion to start after 3 characters.

Open santhoshspecbee opened this issue 3 years ago • 2 comments

Need to show suggestion after 3 characters. Currently shows suggestion after typing a single character.

image

  • I am not able to find an atttrbute to provide minlength
  • Also not able to find any event handlers to stop suggestion till some characters e.g: 3
  • Please give some input to acheive this implementation

santhoshspecbee avatar Jul 01 '22 08:07 santhoshspecbee

@ErrorPro Please review.

santhoshspecbee avatar Jul 07 '22 07:07 santhoshspecbee

@santhoshspecbee Could you please try using debounce prop?

andaden avatar Aug 18 '22 05:08 andaden

@andaden any example on how to use debounce, I use something like this but doesn't work

<Autocomplete
    debounce='1000'
    onPlaceSelected={(data) => {
        this.handlePlaceChange(data);
    }}
/>

prabhakaran8737 avatar Sep 29 '22 00:09 prabhakaran8737

You can use debounce with usePlacesAutocompleteService here is an example.

const {
    placesService,
    placePredictions,
    getPlacePredictions,
    isPlacePredictionsLoading
  } = usePlacesService({
    apiKey: process.env.REACT_APP_GOOGLE,
    debounce: 1500
  });

You can leave a message here suggesting what you would like to add to ErrorPro/react-google-autocomplete

AlexeyRDKV avatar Dec 09 '22 12:12 AlexeyRDKV