[Android] Leading and consecutive spaces are lost when HTML is parsed (iOS keeps them)
Maintainer antworten meist innerhalb von 2 Tagen
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- android, react-native
- Bereich
- mobile
Rechercherichtung
Start with the EnrichedParser.characters() method, which drops spaces that follow another space or a newline, and with the Android serializer that writes a raw space at the start of a paragraph. Run the example app's test screen with <html><p> a b </p><p> c</p></html> to reproduce the difference from iOS. The issue asks the maintainers to choose between keeping whitespace on Android and writing on both platforms, so confirm the direction before editing. Done means both platforms give the same output for that input and the round trip keeps the leading space.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Description
The same HTML gives different text on Android and iOS. Android drops a space at the start of a paragraph and collapses consecutive spaces. iOS keeps both.
This has two effects:
- A paragraph that starts with a space loses that space on a plain
getHTML→setValueround trip on Android. Android itself serializes it as<p> a</p>. - HTML written by iOS loses spaces when it is loaded on Android. iOS serializes two spaces as two raw spaces, Android reads them as one.
Steps to reproduce
- Open the example app and go to the test screen.
- Tap Set Value and submit
<html><p> a b </p><p> c</p></html>. - Tap Show HTML.
| Output | |
|---|---|
| iOS | <p> a b </p><p> c</p> |
| Android | <p>a b </p><p>c</p> |
Round trip on Android only: type a (space, then a), read the HTML (<p> a</p>), set it back. The result is <p>a</p>.
Where it comes from
EnrichedParser.characters() ignores a space that follows another space or a newline. The Android serializer writes for consecutive spaces, so its own output survives for that case, but it writes a raw space at the start of a paragraph. The iOS serializer writes raw spaces in both cases.
Question
Which direction do you prefer?
- Android keeps whitespace as written when it parses the library's own
<html>…</html>format, or - both serializers write
wherever a raw space would be collapsed.
I can open a PR for either one.
Environment
- Library:
mainat 23cc179d - iOS 26.2 simulator (iPhone 17 Pro), Android API 30 emulator
- Vorherrschende Sprache
- C
- Sterne
- 1.4k
- Forks
- 80
- Ø Merge
- 4 T. 19 Std.
- Gemergte PRs (30 T.)
- 21
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus software-mansion/react-native-enriched-html
-
[Web] Leading, trailing, and consecutive spaces in <p> and <codeblock> are stripped by setContent on mount / setValueEvtl. vergeben @pcbeingused333 hat das vor 2 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
software-mansion/react-native-enriched-html#886 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 74/100
software-mansion/react-native-enriched-html#885 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
software-mansion/react-native-enriched-html#881 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 58/100
software-mansion/react-native-enriched-html#880 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
software-mansion/react-native-enriched-html#878 ·
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in software-mansion/react-native-enriched-html
Ähnliche Issues
-
[Android Auto] MU1017 (MHI2Q_JP_AUG22_P1017) cluster map works with a pinned profile — values insideOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
kamgurgul/mib2q-carplay#74 ·
-
Claude:NotNeeded GPT:NotABug triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
open5gs/open5gs#5195 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
FriendsofECCE/ECCE#1358 ·
-
documentation needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
X11Libre/xserver#4255 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 84/100
antoxa2584x/nfsu2-sw#52 ·