0

I am current using this package Autocomplete. The issue I am currently facing is that whenever I press enter one of the props passed into Autocomplete also runs when you press enter. I have tried adding onSubmit and preventing the default and onkeypressed as well but none of it seems to be working. All I want is for onPlaceSelected to not run when enter is pressed here is the code snippet.

<div className={`predictiveSearch ${!empty ? 'filled' : ''}`}>
    <Autocomplete
        id='autocomplete'
        className="searchTerm"
        componentRestrictions={restrictions}
        onBlur={this._handleBlur}
        onChange={this._handleChange}
        onPlaceSelected={this._handlePlaceSelected}
        ref={'input'}
        types={types}
        value={text}
    />
    <span className="searchLabel">{placeholder}</span>
</div>

Any idea if this is possible?

I tried adding a onSubmit and onKeyPressed prop but it id not make a difference. I am wondering whether it is possible to change this.

Mosh Feu
  • 28,354
  • 16
  • 88
  • 135
  • (1) I feel like I'm missing a comma somewhere in `The issue I am currently facing is that whenever I press enter one of the props passed into Autocomplete also runs when you press enter` . I'm not sure what this sentence means (2) Can you create a working example (e.g. codesandbox) to make it easier for us to help? – Mosh Feu Mar 16 '23 at 05:58

0 Answers0