Skip to content

fix(ios): list markers next to emoji not rendered properly - #704

Merged
eszlamczyk merged 4 commits into
mainfrom
fix/702
Aug 31, 2026
Merged

fix(ios): list markers next to emoji not rendered properly#704
eszlamczyk merged 4 commits into
mainfrom
fix/702

Conversation

@eszlamczyk

@eszlamczyk eszlamczyk commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

What/Why?

Fixes #702.

On iOS, an unordered/ordered list item whose text begins with an emoji (e.g. - 🛒 Groceries) rendered two bugs, both regressions introduced in 1.0.0:

  1. The leading emoji glyph was dropped entirely.
  2. Only the last item in the list drew its marker; every preceding item drew no bullet/number/checkbox.
Root Cause

In ListItemRenderer, each item's marker (ListItemMarkerStartAttribute) is anchored on the item's first content character so that items opening with a code block or nested sublist still get a marker (introduced in #478). The anchor was applied over NSMakeRange(anchorLocation, 1) - a single UTF-16 code unit. Emoji are multi-unit graphemes (a surrogate pair like 🛒, or longer ZWJ/flag/variation-selector sequences), so a length-1 attribute run splits the grapheme in two. That split makes NSLayoutManager fail to form the emoji glyph (dropping it), and shifts the paragraph's first mapped character so the marker drawer's "draw only at paragraph start" check skips every item but the last.

Fix

Anchor the marker over the full composed character sequence instead of one code unit

Testing

Added a dedicated "Emoji & Grapheme List Rendering" section to the example app's sampleMarkdown.ts (rendered by the Text screen) covering the issue's exact input plus harder graphemes: ZWJ family sequence, regional-indicator flag, and base+variation-selector, across unordered, ordered, nested, and task lists.

Screenshots

Before After
image image

PR Checklist

  • Code compiles and runs on iOS
  • Code compiles and runs on Android
  • Updated documentation/README if applicable
  • Ran example app to verify changes
  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

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.

Pull request overview

Fixes iOS list rendering for emoji and complex grapheme sequences by anchoring markers across full composed characters.

Changes:

  • Updates marker anchoring in ListItemRenderer.
  • Adds emoji and grapheme list examples to the sample app.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Summary
packages/react-native-enriched-markdown/ios/renderer/ListItemRenderer.m Uses grapheme-safe marker ranges. Add an iOS Maestro regression fixture.
apps/react-native-example/src/sampleMarkdown.ts Adds emoji and complex grapheme rendering examples.

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

hryhoriiK97 and others added 2 commits August 29, 2026 11:24
When the first character of a list item is an emoji, iOS returns the
AppleColorEmoji font for NSFontAttributeName. Its metrics (xHeight,
capHeight) are much larger than the actual text font, causing bullet
dots and checkboxes to be vertically misplaced.

Look past the first composed character sequence to find the real text
font used on the line, and fall back to the default font if the only
font found is AppleColorEmoji.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hryhoriiK97

Copy link
Copy Markdown
Collaborator

@eszlamczyk fyi - pushed a fix in 555c2e5 - ListMarkerDrawer now looks past the leading emoji to use the actual text font's metrics for marker placement.

Zrzut ekranu 2026-08-29 o 12 45 32

@eszlamczyk
eszlamczyk merged commit a30d21f into main Aug 31, 2026
12 checks passed
@eszlamczyk
eszlamczyk deleted the fix/702 branch August 31, 2026 04:17
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.

iOS: emoji dropped from list items + only last item renders a marker (regression since 1.0.0)

3 participants