Skip to content

Commit

Permalink
onKeyPress is not fired on Android when entering an Emoji (#24717)
Browse files Browse the repository at this point in the history
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: #24717

Differential Revision: D15238388

Pulled By: cpojer

fbshipit-source-id: 038b1040e1c44fd6f9401a3988a782f5778e1209
  • Loading branch information
Piotr Trocki authored and facebook-github-bot committed May 7, 2019
1 parent fc8008e commit a5c57b4
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -108,8 +108,8 @@ public boolean setComposingText(CharSequence text, int newCursorPosition) {
@Override @Override
public boolean commitText(CharSequence text, int newCursorPosition) { public boolean commitText(CharSequence text, int newCursorPosition) {
String key = text.toString(); String key = text.toString();
// Assume not a keyPress if length > 1 // Assume not a keyPress if length > 1 (or 2 if unicode)
if (key.length() <= 1) { if (key.length() <= 2) {
if (key.equals("")) { if (key.equals("")) {
key = BACKSPACE_KEY_VALUE; key = BACKSPACE_KEY_VALUE;
} }
Expand Down

0 comments on commit a5c57b4

Please sign in to comment.