onmotion / react-native-autocomplete-dropdown

Dropdown Item picker with search and autocomplete (typeahead) functionality for react native
MIT License
201 stars 79 forks source link

Help -> Avoid 2 press actions to select item from dropdown #49

Open costea93 opened 2 years ago

costea93 commented 2 years ago

Hi, as i see at the moment, we need to press twice to select item and close the dropdown. I guess this happens because we are focused in the input. Is there a way to avoid this, and select the item and close dropdown from 1 press?

stevendeng-ddi commented 2 years ago

We have a similar problem. We click on the down arrow, and then have to press the item twice to select the item. Does anyone have a workaround or solution?

StevenDengXEA commented 2 years ago

I was playing with the code from this example, https://github.dev/onmotion/react-native-autocomplete-dropdown/blob/main/example/components/RemoteDataSetExample3.js The following code works for me. I just blur the text input when the suggestionList is opened. I tested in my proj.


  const onOpenSuggestionsList = useCallback((isOpened) => { 
    if (isOpened) {
      searchRef.current.blur();
    }
  }, [])
onmotion commented 2 years ago

Hi guys! what platform is the issue on? I can't reproduce it

jomann09 commented 2 years ago

I am seeing this as well on iOS, but only when renderItem is set (for me I just used a Text with padding applied) edit: seems like I see it happening even without it set, as mentioned above the first click blurs the input, then you have to click again to actually select a dropdown item

HeyItsJs commented 1 year ago

For me this problem was arising because of using this component inside scrollview. Setting keyboardShouldPersistTaps="always" on ScrollView fixes this problem for me on Android. Not tested on IOS.

rajatkantinandi commented 1 year ago

I am facing same issue on iOS. It works fine on Android and iOS. For me onSelectItem function is called but the selected value shown in the input field is the value I typed not the value I selected. Tried the solutions here: https://github.com/onmotion/react-native-autocomplete-dropdown/issues/62 but does not solve the problem. Attaching a screen recording for reference:

https://github.com/onmotion/react-native-autocomplete-dropdown/assets/17743895/faac8da5-02b9-43bb-8d17-81676596d65b

Can someone help fixing this issue?

bbialas commented 1 year ago

I have the same issue, but I just found out, that it's only when you type text via your hardware keyboard (?!).

If you enable Software keyboard in iOS simulator and you click on letters there, then Autocomplete works as expected... Simulator menu -> I/O -> Keyboard -> Toggle Software Keyboard

rajatkantinandi commented 1 year ago

Still happening for me even if I use software keyboard:

https://github.com/onmotion/react-native-autocomplete-dropdown/assets/17743895/6482129a-6830-480a-af6a-bdae7fff4fc7