You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] [Exploratory] Chat - After switching to landscape mode, user can type on composer but is unable to delete. #87860
Version Number: 9.3.59-3 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#87338 Email or phone of affected tester (no customers):ibellicotest+2250@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Motorola MotoG60 / Android 12 (Hybrid app) App Component: Other
Action Performed:
Open the Expensify app.
Open any chat.
Switch to landscape mode.
Tap on composer.
Type anything on composer but don´t send it to chat.
Switch to portrait mode and return to landscape.
Keep typing on composer.
Note that text is being correctly added.
Try to delete the text.
Note that text is not deleted.
Expected Result:
After switching to landscape mode, user should be able to keep typing on composer and also deleting text.
Actual Result:
After switching to landscape mode, user is able to keep typing on composer but is unable to delete text.
On Android, when the user switches orientation (portrait → landscape → portrait → landscape) with the composer focused, the IME (Input Method Editor) connection to the underlying ReactEditText becomes stale. The composer uses a controlled value prop, so backspace relies entirely on the native IME's InputConnection.deleteSurroundingText — when that connection is broken, backspace events never reach React's onChangeText, and the controlled value immediately restores any natively-deleted text.
The desync is caused by the orientation-change machinery in the native Composer:
useLandscapeOnBlurProxy catches the blur that happens during rotation and re-focuses after a 100ms delay — but this blur/refocus cycle can leave the IME InputConnection in a broken state.
getLandscapeTextInputRefProxy wraps the ref in a Proxy that no-ops focus() calls in landscape, so any system-initiated refocus attempts are silently swallowed.
setTextInputRef is recreated on every isInLandscapeMode toggle, causing React to detach/reattach the callback ref (old ref called with null, new ref called with the element). During this window the parent's composerRef is briefly null.
Typing still works because character insertion is a simple IME append operation, but deletion requires a functioning InputConnection composing/batch-edit state which is broken after the rotation cycle.
What changes do you think we should make in order to solve the problem?
Call RNTextInputReset.resetKeyboardInput(CONST.COMPOSER.NATIVE_ID) after orientation changes to re-establish the IME connection. The most natural place is in useLandscapeOnBlurProxy (index.android.ts) — after the 100ms refocus timeout fires, call resetKeyboardInput to restart the IME input connection. This mirrors the existing pattern used in SuggestionEmoji.
Alternatively, the reset could be triggered in the native Composer's setTextInputRef callback when isInLandscapeMode changes, or via a useEffect watching isInLandscapeMode in ComposerWithSuggestions.
What alternative solutions did you explore? (Optional)
Adding a key prop based on isInLandscapeMode to force a full remount of the RNMarkdownTextInput on orientation change — this would establish a clean IME connection but would lose the current text selection and cursor position, and is heavier than necessary.
Increasing ROTATION_REFOCUS_DELAY_MS — unlikely to help since the issue is the IME connection state, not timing of the focus call.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
changed the title [-][Exploratory] Chat - After switching to landscape mode, user can type on composer but is unable to delete.[/-][+][$250] [Exploratory] Chat - After switching to landscape mode, user can type on composer but is unable to delete.[/+]on May 13, 2026
What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
⚠️@neerajbachani Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).
Please re-state the problem that we are trying to solve in this issue.
On Android, after switching the device to landscape mode with the composer focused, users can continue typing new text but are unable to delete it using backspace. The typed characters appear locally in the IME but are never committed to the controlled input value, and any deletion attempt via backspace fails silently. Expected behavior is that both typing and deletion should work seamlessly across orientation changes.
What is the root cause of that problem?
The bug originates in src/hooks/useLandscapeOnBlurProxy/index.android.ts in the useLandscapeOnBlurProxy hook (lines 18–25). When the device rotates to landscape with the composer focused, the hook detects the orientation change and re-focuses the input after a 100ms delay to maintain focus across the transition. However, re-focusing the underlying ReactEditText does not re-establish the IME's InputConnection — character insertion still works because the IME continues appending text to the composing region, but InputConnection.deleteSurroundingText no longer reaches the native view, so backspace presses never fire onChangeText and the controlled input value immediately reverts any text the IME deleted locally.
The codebase already contains the exact remedy: RNTextInputReset.resetKeyboardInput(nativeId) calls imm.restartInput() to re-establish a fresh InputConnection. This method is successfully used elsewhere in the codebase — specifically in src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx (lines 395–400) after emoji insertion — but it is not invoked after the orientation-triggered refocus in useLandscapeOnBlurProxy, leaving the InputConnection desynchronized.
In ComposerWithSuggestions.tsx the module is obtained with const {RNTextInputReset} = NativeModules (imported from react-native), and access is guarded by a null-check before calling resetKeyboardInput. The same pattern must be applied in the hook.
* Calling clear will immediately clear the input on the UI thread (its a worklet).
What changes do you think we should make in order to solve the problem?
File:src/hooks/useLandscapeOnBlurProxy/index.android.ts Function:useLandscapeOnBlurProxy Description: Add NativeModules to the existing react-native import at the top of the file and destructure RNTextInputReset from it, matching the pattern already used in ComposerWithSuggestions.tsx. In the returned blur handler, after the orientation-triggered setTimeout that re-focuses the input, immediately call RNTextInputReset.resetKeyboardInput(CONST.COMPOSER.NATIVE_ID) inside the same callback — guarded by a null-check on RNTextInputReset in case the native module is unavailable (e.g. in test environments). This re-establishes the IME's InputConnection, allowing both character insertion and deletion to work correctly after landscape transitions.
Because this change lives exclusively in index.android.ts (the other platform entry points — index.ts — return a no-op pass-through), the fix is automatically isolated to Android and cannot affect iOS or web builds.
Blast radius: Minimal. The change is localized to the landscape blur proxy hook and affects only the re-focus path triggered by orientation changes on Android. No other callers or workflows are modified.
What alternative solutions did you explore? (Optional)
After the portrait -> landscape -> portrait -> landscape sequence shown in the recording, the composer view is focused again and text insertion still reaches the field, but the keyboard’s deletion path is stale, so backspace does not update the controlled composer value.
What changes do you think we should make in order to solve the problem?
Restart the Android IME input connection after the landscape refocus completes, and pass the actual input nativeID into the shared blur proxy instead of hard-coding the composer id inside the hook.
Required changes:
Add nativeID={CONST.COMPOSER.NATIVE_ID} to the native composer input so RNTextInputResetModule can find the composer view.
Extend useLandscapeOnBlurProxy with an optional inputResetNativeID.
In index.android.ts, after the delayed focus() call, call RNTextInputReset.resetKeyboardInput(inputResetNativeID) when both the native module and native id are available.
Pass props.nativeID from RNMarkdownTextInput and RNTextInput into the hook.
Leave the non-Android hook as a pass-through, so web and iOS behavior stays unchanged.
Tests that should be added or covered:
Android manual regression: open a chat, type in composer, rotate portrait/landscape as in the issue, keep typing, then verify backspace deletes the text.
Android manual regression for emoji suggestions: insert an emoji suggestion and verify keyboard/composer text stays in sync.
If hook tests are practical in the existing test setup, mock NativeModules.RNTextInputReset, timers, and the landscape state to verify the reset is called only when a native id is provided.
Existing proposals identify the correct IME desync and the correct native reset API, but they put CONST.COMPOSER.NATIVE_ID directly inside the shared landscape blur hook. That leaves the hook resetting the composer even when another native text input triggers the landscape blur path, and it also misses that the reset module searches by nativeID, while the composer currently only sets id.
I also considered forcing a composer remount on orientation changes, but that is heavier and risks losing selection/caret state. Increasing the refocus delay only changes timing and does not restart the stale Android InputConnection.
What alternative solutions did you explore? (Optional)
⚠️@nabi-ebrahimi Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).
I traced this to an Android-only IME desync left behind by the rotation refocus workaround.
When the user does portrait → landscape → portrait → landscape with the composer focused, the second flip into landscape fires a native blur on the underlying ReactEditText. useLandscapeOnBlurProxy catches that blur and re-focuses the input after a 100ms delay so the keyboard pops back up:
The problem is that View.requestFocus() on its own does not rebuild the IME's InputConnection. After the blur/refocus cycle, the IME on a lot of Android keyboards (Gboard / Motorola stock are the classic offenders) keeps editing into a stale, half-detached InputConnection:
New characters still arrive on the JS side — Android keyboards fall back to dispatching plain KEY_DOWN events for printable characters when the connection is degraded, so onChangeText keeps firing and the controlled value keeps growing.
KEYCODE_DEL / backspace, however, is delivered through InputConnection.deleteSurroundingText / setComposingRegion on the stale connection. Those calls never reach the live ReactEditText, so onChangeText never fires, and the controlled value immediately re-renders whatever the IME tried to delete locally — which looks exactly like "delete does nothing".
The codebase already has the standard remedy for this Android-IME-restart class of bug. RNTextInputResetModule.resetKeyboardInput calls InputMethodManager.restartInput() on the view with the matching native id:
It is simply not being called from the rotation path in useLandscapeOnBlurProxy/index.android.ts. The composer input is already tagged with id={CONST.COMPOSER.NATIVE_ID} (which RN maps to the Android native id), so ReactFindViewUtil.findView can find it:
Rejected: the proxy only wraps the external ref handed to the parent (Composer/implementation/index.native.tsx line 74). The inputRef passed into useLandscapeOnBlurProxy is the local useRef inside RNMarkdownTextInput.tsx (line 35) and RNTextInput.tsx (line 23) — both raw, not proxied. So the post-rotation inputRef.current?.focus?.() call genuinely runs and focus is restored. The symptom isn't "no focus", it's "focus restored but IME connection is stale".
What changes do you think we should make in order to solve the problem?
Fix it in the same layer that already owns the rotation workaround: useLandscapeOnBlurProxy/index.android.ts. After the existing setTimeout re-focuses the input, on the same tick, call RNTextInputReset.resetKeyboardInput(...) with the input's native id. That forces imm.restartInput() against the live ReactEditText, which is exactly what's needed to drop the stale InputConnection and rebind a fresh one. Backspace then routes through the new connection and onChangeText fires normally.
Concretely:
In useLandscapeOnBlurProxy/index.android.ts, inside the setTimeout callback, after inputRef.current?.focus?.(), call NativeModules.RNTextInputReset?.resetKeyboardInput(nativeID). Guard with the RNTextInputReset null check used in ComposerWithSuggestions.tsx (line 329) so we don't crash if the module isn't registered (e.g. tests, future Mobile-Expensify hybrid swap).
Plumb the input's native id into the hook rather than hardcoding CONST.COMPOSER.NATIVE_ID. Extend UseLandscapeOnBlurProxy in src/hooks/useLandscapeOnBlurProxy/types.ts with a third arg (e.g. nativeID?: string), and pass props.nativeID ?? props.id from RNMarkdownTextInput.tsx:40 and RNTextInput.tsx:24. The hook is also consumed by RNTextInput, so a hardcoded composer id would (a) wrongly reset the wrong view on non-composer inputs and (b) silently no-op when nativeID isn't set.
Bail out early if the resolved nativeID is undefined — ReactFindViewUtil.findView(root, null) would call restartInput(null), which restarts the IME against the currently focused view; harmless here, but worth being explicit.
Leave the web/iOS pass-through (src/hooks/useLandscapeOnBlurProxy/index.ts) unchanged — iOS doesn't lose focus on rotation and RNTextInputReset is Android-only.
Keep the existing 100ms refocus delay; the IME restart must run after the focus call, otherwise restartInput has no focused view to attach to.
Edge cases worth covering:
Composer is empty when the rotation completes: harmless — restart + empty value just rebinds a fresh connection.
User has an emoji suggestion popup open during rotation: the existing resetKeyboardInput after emoji insertion still runs independently; both paths target the same view by native id, so they don't conflict.
Offline / queued comment drafts: the fix is purely local to the input view; no Onyx writes involved, so offline behavior is unaffected.
What alternative solutions did you explore? (Optional)
Switch the composer to an uncontrolled value on Android. Rejected: the controlled value is load-bearing for draft saving, mention parsing, markdown rendering, and RNMarkdownTextInput's parser worklet — all of which read props.value.
Blur-then-focus instead of just focus inside the timeout. Rejected: imm.restartInput() is the documented fix for stale InputConnection; a JS-side blur/focus cycle relies on RN's TextInput bridging to do the right thing on its own, which is exactly what's failing here.
Toggle key on the input to force remount on rotation. Rejected: remounting tears down the markdown parser, scroll position, selection state, and any in-flight IME composition — a sledgehammer for a problem the existing native module already solves cleanly.
⚠️@oqildev Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).
Activity
MelvinBot commentedon May 13, 2026
Proposal
What is the root cause of that problem?
On Android, when the user switches orientation (portrait → landscape → portrait → landscape) with the composer focused, the IME (Input Method Editor) connection to the underlying
ReactEditTextbecomes stale. The composer uses a controlled value prop, so backspace relies entirely on the native IME'sInputConnection.deleteSurroundingText— when that connection is broken, backspace events never reach React'sonChangeText, and the controlled value immediately restores any natively-deleted text.The desync is caused by the orientation-change machinery in the native Composer:
useLandscapeOnBlurProxycatches the blur that happens during rotation and re-focuses after a 100ms delay — but this blur/refocus cycle can leave the IMEInputConnectionin a broken state.getLandscapeTextInputRefProxywraps the ref in a Proxy that no-opsfocus()calls in landscape, so any system-initiated refocus attempts are silently swallowed.setTextInputRefis recreated on everyisInLandscapeModetoggle, causing React to detach/reattach the callback ref (old ref called withnull, new ref called with the element). During this window the parent'scomposerRefis brieflynull.Typing still works because character insertion is a simple IME append operation, but deletion requires a functioning
InputConnectioncomposing/batch-edit state which is broken after the rotation cycle.Notably,
RNTextInputResetModule.resetKeyboardInput()— which callsimm.restartInput()to fix exactly this kind of IME desync — already exists in the codebase, but is only called when inserting emoji suggestions.What changes do you think we should make in order to solve the problem?
Call
RNTextInputReset.resetKeyboardInput(CONST.COMPOSER.NATIVE_ID)after orientation changes to re-establish the IME connection. The most natural place is inuseLandscapeOnBlurProxy(index.android.ts) — after the 100ms refocus timeout fires, callresetKeyboardInputto restart the IME input connection. This mirrors the existing pattern used inSuggestionEmoji.Alternatively, the reset could be triggered in the native Composer's
setTextInputRefcallback whenisInLandscapeModechanges, or via auseEffectwatchingisInLandscapeModeinComposerWithSuggestions.What alternative solutions did you explore? (Optional)
keyprop based onisInLandscapeModeto force a full remount of theRNMarkdownTextInputon orientation change — this would establish a clean IME connection but would lose the current text selection and cursor position, and is heavier than necessary.ROTATION_REFOCUS_DELAY_MS— unlikely to help since the issue is the IME connection state, not timing of the focus call.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon May 13, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abzokhattab (
External)[-][Exploratory] Chat - After switching to landscape mode, user can type on composer but is unable to delete.[/-][+][$250] [Exploratory] Chat - After switching to landscape mode, user can type on composer but is unable to delete.[/+]melvin-bot commentedon May 13, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022054388386991708619
neerajbachani commentedon May 13, 2026
Proposal
What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
github-actions commentedon May 13, 2026
aswin-s commentedon May 13, 2026
Please re-state the problem that we are trying to solve in this issue.
On Android, after switching the device to landscape mode with the composer focused, users can continue typing new text but are unable to delete it using backspace. The typed characters appear locally in the IME but are never committed to the controlled input value, and any deletion attempt via backspace fails silently. Expected behavior is that both typing and deletion should work seamlessly across orientation changes.
What is the root cause of that problem?
The bug originates in
src/hooks/useLandscapeOnBlurProxy/index.android.tsin theuseLandscapeOnBlurProxyhook (lines 18–25). When the device rotates to landscape with the composer focused, the hook detects the orientation change and re-focuses the input after a 100ms delay to maintain focus across the transition. However, re-focusing the underlying ReactEditText does not re-establish the IME's InputConnection — character insertion still works because the IME continues appending text to the composing region, butInputConnection.deleteSurroundingTextno longer reaches the native view, so backspace presses never fireonChangeTextand the controlled input value immediately reverts any text the IME deleted locally.The codebase already contains the exact remedy:
RNTextInputReset.resetKeyboardInput(nativeId)callsimm.restartInput()to re-establish a fresh InputConnection. This method is successfully used elsewhere in the codebase — specifically insrc/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx(lines 395–400) after emoji insertion — but it is not invoked after the orientation-triggered refocus inuseLandscapeOnBlurProxy, leaving the InputConnection desynchronized.In
ComposerWithSuggestions.tsxthe module is obtained withconst {RNTextInputReset} = NativeModules(imported fromreact-native), and access is guarded by a null-check before callingresetKeyboardInput. The same pattern must be applied in the hook.App/src/hooks/useLandscapeOnBlurProxy/index.android.ts
Lines 18 to 25 in d6a8779
App/src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx
Lines 85 to 95 in d6a8779
What changes do you think we should make in order to solve the problem?
File:
src/hooks/useLandscapeOnBlurProxy/index.android.tsFunction:
useLandscapeOnBlurProxyDescription: Add
NativeModulesto the existingreact-nativeimport at the top of the file and destructureRNTextInputResetfrom it, matching the pattern already used inComposerWithSuggestions.tsx. In the returned blur handler, after the orientation-triggeredsetTimeoutthat re-focuses the input, immediately callRNTextInputReset.resetKeyboardInput(CONST.COMPOSER.NATIVE_ID)inside the same callback — guarded by a null-check onRNTextInputResetin case the native module is unavailable (e.g. in test environments). This re-establishes the IME's InputConnection, allowing both character insertion and deletion to work correctly after landscape transitions.Because this change lives exclusively in
index.android.ts(the other platform entry points —index.ts— return a no-op pass-through), the fix is automatically isolated to Android and cannot affect iOS or web builds.The resulting timeout callback becomes:
And the import block gains
NativeModules:Blast radius: Minimal. The change is localized to the landscape blur proxy hook and affects only the re-focus path triggered by orientation changes on Android. No other callers or workflows are modified.
What alternative solutions did you explore? (Optional)
N/A
aswin-s commentedon May 13, 2026
Updated the proposal above to tighten 4 edge cases (additional guards and broader coverage).
nabi-ebrahimi commentedon May 13, 2026
Proposal
What is the root cause of that problem?
On Android, the landscape blur workaround refocuses the composer after a rotation-triggered blur, but it only calls
focus()after the timeout and never restarts the Android IME input connection: https://github.com/Expensify/App/blob/bc9e4ab64f5e2bfe6da67b474273deec5d37dbfd/src/hooks/useLandscapeOnBlurProxy/index.android.ts#L18-L23After the portrait -> landscape -> portrait -> landscape sequence shown in the recording, the composer view is focused again and text insertion still reaches the field, but the keyboard’s deletion path is stale, so backspace does not update the controlled composer value.
The app already has the native fix for this class of Android keyboard desync:
RNTextInputReset.resetKeyboardInput()finds a view by native id and callsInputMethodManager.restartInput()on it: https://github.com/Expensify/App/blob/bc9e4ab64f5e2bfe6da67b474273deec5d37dbfd/android/app/src/main/java/com/expensify/chat/RNTextInputResetModule.kt#L19-L27That reset is only wired through the emoji suggestion flow today: https://github.com/Expensify/App/blob/bc9e4ab64f5e2bfe6da67b474273deec5d37dbfd/src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx#L395-L399 and https://github.com/Expensify/App/blob/bc9e4ab64f5e2bfe6da67b474273deec5d37dbfd/src/pages/inbox/report/ReportActionCompose/SuggestionEmoji.tsx#L85-L90
The composer native input also sets
id={CONST.COMPOSER.NATIVE_ID}but notnativeID, while the Android reset module searches by native id: https://github.com/Expensify/App/blob/bc9e4ab64f5e2bfe6da67b474273deec5d37dbfd/src/components/Composer/implementation/index.native.tsx#L123-L143What changes do you think we should make in order to solve the problem?
Restart the Android IME input connection after the landscape refocus completes, and pass the actual input
nativeIDinto the shared blur proxy instead of hard-coding the composer id inside the hook.Required changes:
nativeID={CONST.COMPOSER.NATIVE_ID}to the native composer input soRNTextInputResetModulecan find the composer view.useLandscapeOnBlurProxywith an optionalinputResetNativeID.index.android.ts, after the delayedfocus()call, callRNTextInputReset.resetKeyboardInput(inputResetNativeID)when both the native module and native id are available.props.nativeIDfromRNMarkdownTextInputandRNTextInputinto the hook.Tests that should be added or covered:
NativeModules.RNTextInputReset, timers, and the landscape state to verify the reset is called only when a native id is provided.Existing proposals identify the correct IME desync and the correct native reset API, but they put
CONST.COMPOSER.NATIVE_IDdirectly inside the shared landscape blur hook. That leaves the hook resetting the composer even when another native text input triggers the landscape blur path, and it also misses that the reset module searches bynativeID, while the composer currently only setsid.I also considered forcing a composer remount on orientation changes, but that is heavier and risks losing selection/caret state. Increasing the refocus delay only changes timing and does not restart the stale Android
InputConnection.What alternative solutions did you explore? (Optional)
github-actions commentedon May 13, 2026
oqildev commentedon May 13, 2026
Proposal
What is the root cause of that problem?
I traced this to an Android-only IME desync left behind by the rotation refocus workaround.
When the user does portrait → landscape → portrait → landscape with the composer focused, the second flip into landscape fires a native blur on the underlying
ReactEditText.useLandscapeOnBlurProxycatches that blur and re-focuses the input after a 100ms delay so the keyboard pops back up:App/src/hooks/useLandscapeOnBlurProxy/index.android.ts
Lines 11 to 21 in c07f8e4
The problem is that
View.requestFocus()on its own does not rebuild the IME'sInputConnection. After the blur/refocus cycle, the IME on a lot of Android keyboards (Gboard / Motorola stock are the classic offenders) keeps editing into a stale, half-detachedInputConnection:KEY_DOWNevents for printable characters when the connection is degraded, soonChangeTextkeeps firing and the controlledvaluekeeps growing.KEYCODE_DEL/ backspace, however, is delivered throughInputConnection.deleteSurroundingText/setComposingRegionon the stale connection. Those calls never reach the liveReactEditText, soonChangeTextnever fires, and the controlledvalueimmediately re-renders whatever the IME tried to delete locally — which looks exactly like "delete does nothing".The codebase already has the standard remedy for this Android-IME-restart class of bug.
RNTextInputResetModule.resetKeyboardInputcallsInputMethodManager.restartInput()on the view with the matching native id:App/android/app/src/main/java/com/expensify/chat/RNTextInputResetModule.kt
Lines 18 to 29 in c07f8e4
…and we already wire it up successfully for the very similar emoji-suggestion case where the IME's composing region also goes stale:
App/src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx
Lines 328 to 333 in c07f8e4
It is simply not being called from the rotation path in
useLandscapeOnBlurProxy/index.android.ts. The composer input is already tagged withid={CONST.COMPOSER.NATIVE_ID}(which RN maps to the Android native id), soReactFindViewUtil.findViewcan find it:App/src/components/Composer/implementation/index.native.tsx
Lines 120 to 141 in c07f8e4
Alternative I ruled out
I first suspected the
focus()no-op proxy ingetLandscapeTextInputRefProxy:App/src/libs/getLandscapeTextInputRefProxy.ts
Lines 12 to 24 in c07f8e4
Rejected: the proxy only wraps the external ref handed to the parent (
Composer/implementation/index.native.tsxline 74). TheinputRefpassed intouseLandscapeOnBlurProxyis the localuseRefinsideRNMarkdownTextInput.tsx(line 35) andRNTextInput.tsx(line 23) — both raw, not proxied. So the post-rotationinputRef.current?.focus?.()call genuinely runs and focus is restored. The symptom isn't "no focus", it's "focus restored but IME connection is stale".What changes do you think we should make in order to solve the problem?
Fix it in the same layer that already owns the rotation workaround:
useLandscapeOnBlurProxy/index.android.ts. After the existingsetTimeoutre-focuses the input, on the same tick, callRNTextInputReset.resetKeyboardInput(...)with the input's native id. That forcesimm.restartInput()against the liveReactEditText, which is exactly what's needed to drop the staleInputConnectionand rebind a fresh one. Backspace then routes through the new connection andonChangeTextfires normally.Concretely:
useLandscapeOnBlurProxy/index.android.ts, inside thesetTimeoutcallback, afterinputRef.current?.focus?.(), callNativeModules.RNTextInputReset?.resetKeyboardInput(nativeID). Guard with theRNTextInputResetnull check used inComposerWithSuggestions.tsx(line 329) so we don't crash if the module isn't registered (e.g. tests, future Mobile-Expensify hybrid swap).CONST.COMPOSER.NATIVE_ID. ExtendUseLandscapeOnBlurProxyinsrc/hooks/useLandscapeOnBlurProxy/types.tswith a third arg (e.g.nativeID?: string), and passprops.nativeID ?? props.idfromRNMarkdownTextInput.tsx:40andRNTextInput.tsx:24. The hook is also consumed byRNTextInput, so a hardcoded composer id would (a) wrongly reset the wrong view on non-composer inputs and (b) silently no-op whennativeIDisn't set.nativeIDis undefined —ReactFindViewUtil.findView(root, null)would callrestartInput(null), which restarts the IME against the currently focused view; harmless here, but worth being explicit.src/hooks/useLandscapeOnBlurProxy/index.ts) unchanged — iOS doesn't lose focus on rotation andRNTextInputResetis Android-only.restartInputhas no focused view to attach to.Edge cases worth covering:
resetKeyboardInputafter emoji insertion still runs independently; both paths target the same view by native id, so they don't conflict.What alternative solutions did you explore? (Optional)
RNMarkdownTextInput's parser worklet — all of which readprops.value.imm.restartInput()is the documented fix for staleInputConnection; a JS-side blur/focus cycle relies on RN's TextInput bridging to do the right thing on its own, which is exactly what's failing here.keyon the input to force remount on rotation. Rejected: remounting tears down the markdown parser, scroll position, selection state, and any in-flight IME composition — a sledgehammer for a problem the existing native module already solves cleanly.github-actions commentedon May 13, 2026
abzokhattab commentedon May 17, 2026
Unable to reproduce the issue following the steps. Could you please recheck @jponikarchuk
Screen.Recording.2026-05-18.at.00.23.48.mov
jponikarchuk commentedon May 18, 2026
@abzokhattab The issue is not reproducible now