Skip to content

chore: drop react-native-modal InteractionManager handles via patch - #7837

Open
diegolmello wants to merge 2 commits into
developfrom
chore/react-native-modal-drop-interaction-handles
Open

diegolmello wants to merge 2 commits into
developfrom
chore/react-native-modal-drop-interaction-handles

Conversation

@diegolmello

@diegolmello diegolmello commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Proposed changes

React Native 0.87 removes InteractionManager, and on 0.88 any access to it throws. react-native-modal 13.0.1 calls InteractionManager.createInteractionHandle() / clearInteractionHandle() around its open and close animations, so every modal open would crash after the upgrade. The latest release (14.0.0-rc.1) still uses it, so a version bump doesn't help.

This extends the existing patches/react-native-modal+13.0.1.patch to remove those calls, the interactionHandle field that only guarded them, and InteractionManager from the import (dist/modal.js and dist/modal.d.ts).

There is no behaviour change on the current RN 0.86. createInteractionHandle() always returns -1, and clearInteractionHandle() does nothing with that value, because RN has ignored interaction handles since 0.82. The library never calls runAfterInteractions, so nothing needs a replacement.

The two-factor modal also stops relying on autoFocus for its code input. On Android the field got a cursor before the modal finished opening, but the soft keyboard stayed down until the field was tapped. The input is now focused from the modal's onModalShow, as the join code modal already does, so the keyboard rises with the modal on both platforms.

App code that still uses InteractionManager is handled separately.

Issue(s)

https://rocketchat.atlassian.net/browse/NATIVE-1825

How to test or reproduce

Open and close each modal on iOS and Android and confirm the open and close animations look the same as before:

  • Two-factor authentication: log in with an account that has TOTP 2FA. Without tapping the code field, the software keyboard rises with the modal (Android too). Enter the code, press Verify.
  • Screen lock passcode: Settings → Security and privacy → Screen lock, turn the switch on, set and confirm a passcode.
  • Screen locked: with screen lock on and auto-lock "After 1 minute", put the app in the background for over a minute and come back, then enter the passcode.
  • Room announcement: open a room with an announcement, tap the banner, tap outside to close.
  • Join code: open a channel with a join code you're not a member of, tap Join, press Cancel.

To check the patch: after pnpm install, grep -n InteractionManager node_modules/react-native-modal/dist/* returns nothing.

Screenshots

Each clip opens and closes the modal with this patch applied (iOS simulator, Android emulator).

The two-factor and join code clips type into the field with the software keyboard open; the field, the typed text and both buttons stay above the keyboard.

Two-factor authentication

The code field is not tapped: the keyboard rises on its own as the modal opens and is fully up about 0.4 s later on both platforms. Before this change, Android kept the keyboard down until the field was tapped.

iOS

ios-twofactor-onmodalshow.mp4

Android

android-twofactor-onmodalshow.mp4

Screen lock passcode set-up

iOS

ios-change-passcode.mp4

Android

android-change-passcode.mp4

Screen locked

iOS

ios-screen-locked.mp4

Android

android-screen-locked.mp4

Room announcement

iOS

ios-banner.mp4

Android

android-banner.mp4

Join code

iOS

ios-joincode-keyboard.mp4

Android

android-joincode-keyboard.mp4

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

The patch was verified on an iOS simulator and an Android emulator: each of the modals above opens and closes normally, with no errors. The Jitsi auth modal also uses react-native-modal but was not exercised, since it only appears for legacy Jitsi web calls that need authentication.

Summary by CodeRabbit

  • Bug Fixes
    • Improved hardware back-button handling when a modal is removed, helping prevent stale back-button behavior.

createInteractionHandle/clearInteractionHandle are no-op stubs since RN 0.82 and InteractionManager is removed in RN 0.87, so react-native-modal would crash on open once the API is gone.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d7f82fbe-ae23-4ddd-b42d-9593291a2c85
Commits

Reviewing files that changed from the base of the PR and between d1d2081 and 6d57a99.

Files selected for processing: 1
  • app/containers/TwoFactor/index.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Recent review details
Context from checks skipped due to timeout: 2
  • GitHub Check: ESLint and Test / run-eslint-and-test
  • GitHub Check: E2E Shard Preflight
Additional context used
Code guidelines: 1
CLAUDE.md — auto-discovered
Path-based instructions: 1
Source excerpt: Local-first data flow: the UI reads from WatermelonDB, sagas sync it with the server.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • app/containers/TwoFactor/index.tsx
Additional comments: 1
app/containers/TwoFactor/index.tsx: 1

80-81: LGTM!

Also applies to: 165-166

Walkthrough

The modal patch removes InteractionManager handle management and updates hardware-back listener cleanup. The two-factor screen now focuses the code field when its modal is shown.

Changes

Modal behavior updates

Layer / File(s) Summary
Update modal lifecycle handling
patches/react-native-modal+13.0.1.patch
The modal removes interactionHandle and its show, hide, and unmount operations. It stores the subscription returned by BackHandler.addEventListener and removes it during unmount.
Focus the code field on modal show
app/containers/TwoFactor/index.tsx
The modal’s show event calls setFocus('code'). The input no longer uses autoFocus.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

Suggested labels: type: bug

Suggested reviewers: otaviostasiak, rohit3523

Merge Risk: Minimal · up to 6d57a

No concrete merge-blocking defect is established in the changed modal or two-factor flows.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the primary change: removing react-native-modal InteractionManager handles through a patch.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Errors were encountered while retrieving linked issues.

Errors: 1
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

iOS Build Available

Rocket.Chat 4.78.0.110086

@OtavioStasiak OtavioStasiak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This branch is waiting to be deployed

3 waiting deployments
ios_build — 6d57a99e Waiting Oct 26, 2026 by diegolmello via Build iOS / Hold #7543
android_build — 6d57a99e Waiting Oct 26, 2026 by diegolmello via Build Android / Hold #7543
approve_e2e_testing — 6d57a99e Waiting Oct 26, 2026 by diegolmello via E2E Hold #7543
upload_android — d1d20811 Deployed Oct 25, 2026 by diegolmello via Build Android / Upload Hold #7520
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants