akveo / react-native-ui-kitten

:boom: React Native UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
https://akveo.github.io/react-native-ui-kitten/
MIT License
10.19k stars 952 forks source link

Autocomplete onBlur handler isn't called as expected #1755

Open Codelica opened 1 year ago

Codelica commented 1 year ago

🐛 Bug Report

To Reproduce

Steps to reproduce the behavior:

  1. Take the sample code for "Autocomplete Simple Usage" from https://akveo.github.io/react-native-ui-kitten/docs/components/autocomplete/overview#autocomplete

  2. Add a simple onBlur handler like:

onBlur={() => { alert('onBlur called!'); }}

  1. Use the Autocomplete component -> Enter some text then make it loose focus by touching/clicking on the background.

  2. Notice that the onBlur handler is not called.

Expected behavior

If supplied, onBlur should be called whenever the Autocomplete element loosed focus.

Link to runnable example or repository (highly encouraged)

Can't seem to make a runnable Expo Snack currently, getting an odd error trying to load React.

UI Kitten and Eva version

Package Version
@eva-design/eva 2.1.1
@ui-kitten/components 5.3.1

Environment information

System:
    OS: macOS Mojave 10.14.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 8.3.1 - ~/.nvm/versions/node/v16.13.0/bin/npm
    Watchman: 2021.06.07.00 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7199119
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  npmPackages:
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.8 => 0.71.8 
Codelica commented 1 year ago

Looking at this further, it seems to depend if Autocomplete is in a ScrollView and if so, if the ScrollView has keyboardShouldPersistTaps='always' set to be inline with this change so that double taps of items aren't needed. Only setting keyboardShouldPersistTaps='never' seems to allow the onBlur event to hit but that also results in issue like needing double taps, not being able to select the Autocomplete again, etc that always solved. Seems like some re-working will be necessary for onBlur to hit.

ricardodolnl commented 1 year ago

Can someone give me a status update on this bug? Any time indication for the fix? If it takes to long to fix I'll need to find another solution.