Closed richthedev closed 6 years ago
@richthedev found any solution?
@jwohlfert23 any suggestion how we can fix this?
I will look into this over the weekend and let you know. Thanks for the heads up about the issue.
@jwohlfert23 thanks for response. Any progress?
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.
Hi @ashoat, I’m looking to finish off the PR and get it landed. Hopefully this will be possible soon!
@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!
@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
Thanks to @joshyhargreaves this is now working on React Native 0.53!
Works great on iOS, but on Android nothing happens.