Skip to content

Mount inline views inside PreparedLayoutTextView - #59923

Open
jasozh wants to merge 1 commit into
react:mainfrom
jasozh:export-D127947575
Open

jasozh wants to merge 1 commit into
react:mainfrom
jasozh:export-D127947575

Conversation

@jasozh

@jasozh jasozh commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Summary:
Fixes an issue on Android where inline views/images are not correctly clipped when created within a Text parent.

Root Cause

ReactTextView is a plain View which cannot hold any child views, so ParagraphShadowNode disables FormsStackingContext for text. This means Fabric flatten's the paragraph's children, so any inline views become siblings of the text. This makes it impossible for inline views to be clipped by their parent Text.

This PR

Since PreparedTextView is recently being enabled by default and uses a ViewGroup which allows children, modify ParagraphShadowNode to re-enable FormsStackingContext if the flag is true.

Changelog: [Android][Fixed] - Inline views and images are now clipped by a parent <Text> when prepared text layout is enabled

Differential Revision: D127947575

Summary:
Fixes an issue on Android where inline views/images are not correctly clipped when created within a Text parent.

### Root Cause

ReactTextView is a plain View which cannot hold any child views, so ParagraphShadowNode disables `FormsStackingContext` for text. This means Fabric flatten's the paragraph's children, so any inline views become siblings of the text. This makes it impossible for inline views to be clipped by their parent Text.

### This PR

Since PreparedTextView is recently being enabled by default and uses a ViewGroup which allows children, modify ParagraphShadowNode to re-enable `FormsStackingContext` if the flag is true.

Changelog: [Android][Fixed] - Inline views and images are now clipped by a parent `<Text>` when prepared text layout is enabled

Differential Revision: D127947575
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 10, 2026
@meta-codesync

meta-codesync Bot commented Nov 10, 2026

Copy link
Copy Markdown

@jasozh has exported this pull request. If you are a Meta employee, you can view the originating Diff in D127947575.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant