Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[iOS] Named entity   rendered literally, then saved as  

オープン
#818 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
html, objective-c, react-native
領域
frontend, mobile

調査の方向性

Start with ios/extensions/StringExtension.mm and inspect getEscapedCharactersInfoFrom and its unescapeMap; the issue identifies this as the iOS decoding path. Compare its named-reference handling with the existing numeric-reference handling and the suggested entities. Done when the reproduction renders a non-breaking space on iOS and getHTML() or onChangeHtml no longer turns   into  ; check whether the existing iOS tests cover this path.

索引モデルが issue の本文から書いたものです。

説明

bug
Before submitting a new issue
  • I tested using the latest version of the library, as the bug might be already fixed. (1.1.1, the latest release; the code below is unchanged on main @ 0d015a7b1d)
  • I tested using a supported version of react native.
  • I checked for possible duplicate issues, with possible answers. (Related but different: #235 / #258 fixed & < >, and #636 / #638 fixed numeric references.)
Bug summary

On iOS, EnrichedTextInput (and EnrichedText) render the named character reference   as the literal six characters  . The next getHTML() / onChangeHtml then escapes the &, so the stored HTML becomes  . After that, the literal text shows up on every platform, because it is now real text.

  is very common input. The HTML serialization algorithm (WHATWG "escaping a string") writes U+00A0 as  . So HTML produced on the web (innerHTML, this library's web editor, Tiptap/ProseMirror getHTML()) contains it whenever the text has a non-breaking space. Browsers insert one for a trailing or double space typed in a contenteditable. This library's Android serializer (EnrichedParser.withinStyle) also writes runs of spaces as  . So content written on web or Android and then edited on iOS gets corrupted.

Cause: getEscapedCharactersInfoFrom in ios/extensions/StringExtension.mm only maps &, < and >, plus numeric references. Android (TagSoup) and web (DOMParser) decode named references.

Suggested fix: add at least   → U+00A0, " → " and ' → ' to unescapeMap. Ideally, decode the full HTML5 named-reference table.

Workaround we use for now: before passing HTML to the component, rewrite   / " / ' to   / " / ', which iOS already decodes.

Library version

1.1.1

Environment info
react-native 0.86.2
expo 57.0.14 (dev client, new architecture)
react 19.2.3
iOS Simulator 18.6 (iPhone 16 Pro); also seen on a physical iPhone running iOS 26
Steps to reproduce
  1. On iOS, render an EnrichedTextInput with:
    <EnrichedTextInput defaultValue={'<html><p>Hello&nbsp;world</p></html>'} onChangeHtml={(e) => console.log(e.nativeEvent.value)} />
    
  2. Observed: the input shows Hello&nbsp;world. Expected: Hello world, with a non-breaking space.
  3. Type one character. Observed in onChangeHtml: …Hello&amp;nbsp;world…. Expected: U+00A0 (or &nbsp;), not &amp;nbsp;.
  4. The same HTML on Android and web renders correctly.
Reproducible example repository

No standalone repo yet. The steps above use the stock component only, with no app code involved.

主要言語
C
スター
1.4k
フォーク
73
平均マージ
2日 10時間
マージ済み PR(30日)
7

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

software-mansion/react-native-enriched-html のほかの issue

software-mansion/react-native-enriched-html の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。