Skip to content

Commit 13cb5a9

Browse files
mdvaccakelset
authored andcommitted
Fix IllegalStateException when tapping next on Android Keyboard
Summary: This diff fixes an IllegalStateException that is thrown when the user click is on a edit text and tap 'Next' on the keyboard to focus on the next view, but the next view is hidden. Reviewed By: lunaleaps, mmmulani Differential Revision: D14598410 fbshipit-source-id: 2999cc468ed24bedff163eedcfaec50f6ee005d6
1 parent 775553b commit 13cb5a9

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
package com.facebook.react.views.textinput;
99

10+
import static android.view.View.FOCUS_FORWARD;
11+
1012
import android.annotation.TargetApi;
1113
import android.graphics.PorterDuff;
1214
import android.graphics.Typeface;
@@ -882,6 +884,12 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent keyEvent) {
882884

883885
// Prevent default behavior except when we want it to insert a newline.
884886
return blurOnSubmit || !isMultiline;
887+
} else if (actionId == EditorInfo.IME_ACTION_NEXT) {
888+
View v1 = v.focusSearch(FOCUS_FORWARD);
889+
if (v1 != null && !v.requestFocus(FOCUS_FORWARD)) {
890+
return true;
891+
}
892+
return false;
885893
}
886894

887895
return true;

0 commit comments

Comments
 (0)