Skip to content

feat(ios): add textAlignment#403

Open
kacperzolkiewski wants to merge 8 commits intomainfrom
@kacperzolkiewski/text-alignment
Open

feat(ios): add textAlignment#403
kacperzolkiewski wants to merge 8 commits intomainfrom
@kacperzolkiewski/text-alignment

Conversation

@kacperzolkiewski
Copy link
Collaborator

@kacperzolkiewski kacperzolkiewski commented Jan 29, 2026

Summary

This PR:

  1. Adds textAlignment support on iOS
  2. Applies a minimal NSKernAttributeName to zero-width spaces (\u200B).
  • ZWS has zero advance width, NSLayoutManager produces a zero-width usedRect for ZWS-only lines, which under right/center alignment collapses the line height. The minimal kerning gives the glyph a non-zero advance, preserving line geometry while remaining invisible.

Test Plan

Run example app and play with textAlignment when different styles are toggled.
Check if paragraphs/lists with different textAlignment than left are properly parsed and contain style="text-align:center|right|justify" inside HTML

Screenshots / Videos

Screen.Recording.2026-03-11.at.11.05.29.mov

Compatibility

OS Implemented
iOS
Android

@kacperzolkiewski kacperzolkiewski marked this pull request as ready for review March 11, 2026 10:17
@kacperzolkiewski kacperzolkiewski requested review from exploIF and szydlovsky and removed request for szydlovsky March 11, 2026 10:17
@MartycFly321
Copy link

@kacperzolkiewski Awesome feature! Would love to see it implemented.
I remember from the foreground color PR that it only gets approved if it works for IOS AND Android:

#266 (comment)
"Hey @IvanIhnatsiuk, it's super nice to get such verbose contribution from the community! While the feature is potentially interesting for us we cannot really proceed with it for now; we want the API and new features to be working on both mobile platforms from the get-go. Either way, great work!"

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