onKeyPress is not fired on Android when entering an Emoji (#24717)

Summary:
Resolve #24690

This is very simple unicode detecting. Should I improve this solution creating StringsUtils for detecting unicodes in whole react-native project ?

[Android][Fixed] onKeyPress method is calling, when user type emoji
Pull Request resolved: https://github.com/facebook/react-native/pull/24717

Differential Revision: D15238388

Pulled By: cpojer

fbshipit-source-id: 038b1040e1c44fd6f9401a3988a782f5778e1209
This commit is contained in:
Piotr Trocki
2019-05-07 04:03:51 -07:00
committed by Facebook Github Bot
parent fc8008e0b2
commit a5c57b4ed4

View File

@@ -108,8 +108,8 @@ class ReactEditTextInputConnectionWrapper extends InputConnectionWrapper {
@Override
public boolean commitText(CharSequence text, int newCursorPosition) {
String key = text.toString();
// Assume not a keyPress if length > 1
if (key.length() <= 1) {
// Assume not a keyPress if length > 1 (or 2 if unicode)
if (key.length() <= 2) {
if (key.equals("")) {
key = BACKSPACE_KEY_VALUE;
}