jwohlfert23 / react-native-tag-input

A simple React Native component that creates an input for tags, emails, etc.
MIT License
232 stars 104 forks source link

On Android, I cannot delete a tag using "backspace" #31

Closed richthedev closed 6 years ago

richthedev commented 7 years ago

Works great on iOS, but on Android nothing happens.

zarcode commented 7 years ago

@richthedev found any solution?

zarcode commented 7 years ago

@jwohlfert23 any suggestion how we can fix this?

jwohlfert23 commented 7 years ago

I will look into this over the weekend and let you know. Thanks for the heads up about the issue.

zarcode commented 6 years ago

@jwohlfert23 thanks for response. Any progress?

Ashoat commented 6 years ago

The reason for this is that the onKeyPress callback is only supported on iOS at the moment. This issue tracks it: #1882.

There's a workaround for this, which is to use the onChange callback. However, it won't work in our case because it doesn't fire when backspace is typed but the TextInput is empty.

In other words, there is literally no way to do this on Android in React Native at the moment.

There are a couple PRs out there. #14720 seems to be the most promising one.

joshjhargreaves commented 6 years ago

Hi @ashoat, I’m looking to finish off the PR and get it landed. Hopefully this will be possible soon!

joshjhargreaves commented 6 years ago

@Ashoat do you think you could test the PR to see if it works as you'd expect (to fix this open issue)? https://github.com/facebook/react-native/pull/14720. Thanks!

Ashoat commented 6 years ago

@joshyhargreaves - I went ahead and gave it a try, but I couldn't get the Android version to build, even after running react-native eject.

I basically tried:

$ npm install git+https://git@github.com/joshyhargreaves/react-native.git#implement_onKeyPress_android
$ rm -rf node_modules
$ cd Example
$ npm install git+https://git@github.com/joshyhargreaves/react-native.git#implement_onKeyPress_android
$ rm -rf node_modules
$ yarn
$ rm -rf ios
$ rm -rf android
$ react-native eject
$ react-native run-android

Here's the full error: https://gist.github.com/Ashoat/83a8dd7602e9a2b06c6afa409210c94e

Ashoat commented 6 years ago

Thanks to @joshyhargreaves this is now working on React Native 0.53!