Skip to content

fix(ios): relayout inline images when dimensions are known - #804

Open
hejsztynx wants to merge 1 commit into
mainfrom
@ksienkiewicz/fix-ios-enriched-text-img-relayout
Open

hejsztynx wants to merge 1 commit into
mainfrom
@ksienkiewicz/fix-ios-enriched-text-img-relayout

Conversation

@hejsztynx

Copy link
Copy Markdown
Collaborator

Summary

fixes #798

On iOS, rendered EnrichedText did not relayout the attachments (inline images), after the TextView knew its actual size. Any attachment relayout (precisely layoutAttachments method call) was only carried out when textView.frame and textView.contentSize values were respectively {{0, 0}, {0, 0}} and {0, 0}.

This caused inline images to not wrap correctly in EnrichedText. Also images would disappear or be incorrectly positioned on layout changes - the issue described in #798

All EnrichedText related e2e tests pass successfully.

Test Plan

Add some inline images in the input, so they wrap around the lines and then push the text into the EnrichedText. Images should wrap there identically.

Screenshots / Videos

Inline images wrapping behavior:

Before:

image

After:

image

Bug reproduction provided in #798

Before:

Screen.Recording.2026-09-22.at.15.42.00.mov

After:

Screen.Recording.2026-09-22.at.15.36.01.mov

Compatibility

OS Implemented
iOS
Android
Web

Checklist

  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

Copilot AI lite review requested due to automatic review settings September 22, 2026 13:46

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.

Copilot review overview

🟡 Changes recommended

Address repeated layout work and add regression coverage for inline-image wrapping.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Fixes iOS inline-image positioning by relayouting attachments after the text view receives its actual dimensions.

Changes:

  • Exposes the attachment relayout API.
  • Triggers attachment positioning during layoutSubviews.
File Summary Review notes
ios/​EnrichedTextView.h Declares the attachment relayout API.
ios/​enrichedTextTextView/​EnrichedTextTextView.mm Relayouts attachments after layout. Limit repeated full relayouts to geometry changes and add regression coverage for inline-image wrapping after layout changes.

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

Comment thread ios/enrichedTextTextView/EnrichedTextTextView.mm

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text immediately before an <img> sometimes fails to repaint on iOS after a screen revisit (EnrichedText)

2 participants