Skip to content

fix(Android): setClientRect after drawing wrapped text in TSpanView with inlineSize#2965

Open
dashitongzhi wants to merge 1 commit into
software-mansion:mainfrom
dashitongzhi:fix-inlineSize-onLayout-android
Open

fix(Android): setClientRect after drawing wrapped text in TSpanView with inlineSize#2965
dashitongzhi wants to merge 1 commit into
software-mansion:mainfrom
dashitongzhi:fix-inlineSize-onLayout-android

Conversation

@dashitongzhi

Copy link
Copy Markdown

Fixed issue #1257. TSpanView.java now calls setClientRect() after drawing wrapped text with inlineSize on Android.

…eSize

When a TSpan has inlineSize set and contains text content (mContent != null),
the draw() method was calling drawWrappedText() which renders the text using
StaticLayout but never calling setClientRect(). This caused the onLayout
event to fire with incorrect dimensions (height=0, y=0) on Android.

The fix:
1. Extract layout creation into createWrappedTextLayout() method that also
   computes and stores the text position (dx, dy)
2. Call setClientRect() with the proper bounds after drawing the wrapped text
3. Reuse the same layout for both fill and stroke painting

This ensures the nativeEvent.layout in onLayout callback receives correct
width, height, x, and y values when using inlineSize on TSpan elements.

Fixes issue software-mansion#1257
Copilot AI review requested due to automatic review settings May 22, 2026 01:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

2 participants