Repository navigation
Conversation
miniware9
force-pushed
the
double-r-reload-text-editors
branch
from
December 3, 2026 17:48
1b2072f to
cb7f028
Compare
Signed-off-by: Swamini Kulkarni <swaminikulkarni1@gmail.com>
Signed-off-by: Swamini Kulkarni <swaminikulkarni1@gmail.com>
miniware9
force-pushed
the
double-r-reload-text-editors
branch
from
December 5, 2026 20:12
cb7f028 to
5e40c42
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
In a debug build,
DoubleTapReloadRecognizerreloads the JavaScript when R is pressed twice within 200 ms, unless the focused view is anEditText.A text field that isn't an
EditTextgets no such exemption, so typing a word with two r's close together into it, such as "error", reloads the app and drops what was typed.Jetpack Compose text fields are such fields: while one has focus, the focused view is Compose's
AndroidComposeView.@expo/ui'sTextInputrenders one on Android, for example.A text field in a
Modalgets no exemption either,EditTextor not: the Modal's dialog hands every key-up but Back and Escape on to the activity'sonKeyUp, andReactDelegategives the recognizeractivity.currentFocus, which is in the activity's window, never the dialog's.Only key events reach the check, as a hardware keyboard sends them, such as the computer's keyboard typing into an emulator.
This change also exempts a focused view whose
onCheckIsTextEditor()is true, the method Android documents for a view to say it is a text editor.AndroidComposeViewreturns true while one of its text fields has focus.An
EditTextstays exempt as before, including one whose input type isTYPE_NULL, for whichonCheckIsTextEditor()is false.For a text field in another window, such as a Modal's,
ReactDelegateskips the check whileInputMethodManager.isAcceptingText()is true, as it is while a text field takes input.With no text field focused, R twice still reloads, in a Modal too.
Reproducer: https://github.com/miniware9/react-native-android-double-r-reloads-while-typing
Changelog:
[ANDROID] [FIXED] - Typing R twice into a focused text field no longer reloads the app when the field isn't an
EditText, such as a Jetpack Compose text field, or is in aModalTest Plan:
I ran the reproducer, a blank Expo SDK 58 app on React Native 0.88.1 with a Compose text field (
@expo/ui'sTextInput), a React NativeTextInputand a focusable view that isn't a text field, on the screen and again in aModal, as a debug build on an Android 17 emulator (x86_64).I built it against 0.88.1's
react-androidas published, and again with this change:DoubleTapReloadRecognizerandReactDelegatecompiled from the patched sources, in place of the published classes in a copy ofreact-android-0.88.1-debug.aarserved from a local Maven repository.Each case starts from a fresh launch, and a reload is the app logging its JavaScript loading again after the keys were sent.
Each build gave the same results on two runs.
adb shell input keyevent KEYCODE_R KEYCODE_Radb shell input text rrrr, no reloadTextInputadb shell input text rrrr, no reloadrr, no reloadModaladb shell input keyevent KEYCODE_R KEYCODE_RModaladb shell input text rrModalclosesrr, no reloadTextInputin theModaladb shell input text rrModalclosesrr, no reloadktfmt 0.59.0, run as
yarn format-kotlinruns it, leaves the changed files as they are.