Skip to content

[Android] Fix crash when a Text inside a detector gets an inline View - #4588

Merged
m-bert merged 3 commits into
software-mansion:mainfrom
gigobyte:fix/android-detector-text-inline-view
Oct 13, 2026
Merged

m-bert merged 3 commits into
software-mansion:mainfrom
gigobyte:fix/android-detector-text-inline-view

Conversation

@gigobyte

Copy link
Copy Markdown
Contributor

Description

Fixes #4585

Test plan

  1. Reproduction example from the issue report no longer crashes the app
  2. Smoke testing this change in a large application didn't lead to a regression is any other behaviour

Copilot AI balanced review requested due to automatic review settings October 12, 2026 13:32
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cb37b862-b496-47b9-a667-7f86d698580b

📥 Commits

Reviewing files that changed from the base of the PR and between b5e69bc and 4fc6c34.


📒 Files selected for processing (1)
  • packages/react-native-gesture-handler/shared/shadowNodes/react/renderer/components/rngesturehandler_codegen/RNGestureHandlerDetectorShadowNode.cpp

🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/react-native-gesture-handler/shared/shadowNodes/react/renderer/components/rngesturehandler_codegen/RNGestureHandlerDetectorShadowNode.cpp

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



📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of cloned text paragraphs in Android gesture-handler views. Paragraph nodes no longer receive the stacking-context trait applied to other cloned nodes, helping prevent unexpected rendering behavior while preserving the existing handling of other content.

Walkthrough

On Android, unflattenNode returns cloned Paragraph nodes after assigning FormsView and before assigning FormsStackingContext. Other nodes retain the existing trait assignment.

Changes

Android Paragraph Trait Handling

Layer / File(s) Summary
Skip stacking-context assignment for Android Paragraph nodes
packages/react-native-gesture-handler/shared/shadowNodes/react/renderer/components/rngesturehandler_codegen/RNGestureHandlerDetectorShadowNode.cpp
The code checks the component name on Android and returns cloned Paragraph nodes before assigning FormsStackingContext. It adds <cstring> for the std::strcmp check.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 4fc6c

The change addresses the reported Android crash, and no actionable merge-blocking risk was identified.

Pre-merge checks | Passed 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the Android crash fix that the pull request implements.
Linked Issues check Passed Issue #4585 requires an Android fix for a Text (Paragraph) directly inside InterceptingGestureDetector when it receives an inline View. The PR changes `RNGestureHandlerDetectorShadowNode::unfl…
Out of Scope Changes check Passed The reviewed change only updates RNGestureHandlerDetectorShadowNode.cpp. It adds the required <cstring> include and applies the Android-specific Paragraph trait change. The change directly suppo…

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

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.

Copilot AI 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.

🟢 Approval recommended

The narrowly scoped change addresses the reported mounting crash without affecting other platforms.

0 open findings

What changed in this PR

Prevents Android crashes when a gesture detector wraps text containing an inline view.

Changes:

  • Detects Android Paragraph shadow nodes.
  • Avoids forcing them to form stacking contexts.
File Description
RNGestureHandlerDetectorShadowNode.cpp Adds Android-specific Paragraph trait handling.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@m-bert m-bert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for finding and fixing this issue! ❤️

I took the liberty of adding a comment and merging main. I didn't want to bother you, hope you don't mind 😅

@gigobyte

Copy link
Copy Markdown
Contributor Author

No problem at all, I removed it because it was AI-generated and I don't know enough about Native development to assess the accuracy of the comment.

@m-bert
m-bert merged commit 53da095 into software-mansion:main Oct 13, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] Rendering a View inside a Text wrapped in InterceptingGestureDetector crashes

3 participants