Closed hoanghuychh closed 2 years ago
@hoanghuychh Hello! I need more context: what are you trying to achieve?
@sickdyd Thank you for your reply, I want to press Enter key to do a search action and can I do it, like the bar search's google?
@hoanghuychh I think you mean to use the onSearch
callback. Please check the readme file for more.
Yes I used it but the onSearch
can't get keydown Enter
event or any onKeyDown
event :((
@hoanghuychh Ah, now I understand: you want to know what key has been pressed. There is no way to do it right now. Can you tell me why you want to know which key has been pressed?
This PR is implementing arrow key navigation so it might help you out: https://github.com/sickdyd/react-search-autocomplete/pull/34
Hi!
I tried to achieve the same behaviour. My solution was to wrap the autocomplete in a form with a onSubmit callback and store the input value in a state which is updated every onSearch call.
When you press “return” key, use the onSubmit callback to use your stored input value.
@Alex-Licea Thank you, that seems like a good solution for this issue.
Hi I'm using ur package but I can't handle the event press enter key, Do you have any suggestions for me?