Skip to content

Commit

Permalink
Fix ReactEditText so it works with Android Emoji2 automatic support
Browse files Browse the repository at this point in the history
  • Loading branch information
designedbyz committed May 31, 2022
1 parent 91452fc commit fcde652
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public class ReactEditText extends AppCompatEditText
private @Nullable SelectionWatcher mSelectionWatcher;
private @Nullable ContentSizeWatcher mContentSizeWatcher;
private @Nullable ScrollWatcher mScrollWatcher;
private final InternalKeyListener mKeyListener;
private InternalKeyListener mKeyListener;
private boolean mDetectScrollMovement = false;
private boolean mOnKeyPress = false;
private TextAttributes mTextAttributes;
Expand Down Expand Up @@ -140,7 +140,9 @@ public ReactEditText(Context context) {
mListeners = null;
mTextWatcherDelegator = null;
mStagedInputType = getInputType();
mKeyListener = new InternalKeyListener();
if (mKeyListener == null) {
mKeyListener = new InternalKeyListener();
}
mScrollWatcher = null;
mTextAttributes = new TextAttributes();

Expand Down Expand Up @@ -451,6 +453,10 @@ public void setInputType(int type) {
// We override the KeyListener so that all keys on the soft input keyboard as well as hardware
// keyboards work. Some KeyListeners like DigitsKeyListener will display the keyboard but not
// accept all input from it
if (mKeyListener == null) {
mKeyListener = new InternalKeyListener();
}

mKeyListener.setInputType(type);
setKeyListener(mKeyListener);
}
Expand Down

0 comments on commit fcde652

Please sign in to comment.