[Android] Leading and consecutive spaces are lost when HTML is parsed (iOS keeps them)
Les mainteneurs répondent en général sous 2 jours
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- android, react-native
- Domaine
- mobile
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- C
- Étoiles
- 1.4k
- Forks
- 80
- Merge moyen
- 4 j 19 h
- PR mergées (30 j)
- 21
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de software-mansion/react-native-enriched-html
-
[Web] Leading, trailing, and consecutive spaces in <p> and <codeblock> are stripped by setContent on mount / setValuePeut-être pris @pcbeingused333 l’a pris il y a 2 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
software-mansion/react-native-enriched-html#886 ·
Les mainteneurs répondent en général sous 2 jours
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 74/100
software-mansion/react-native-enriched-html#885 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
software-mansion/react-native-enriched-html#881 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 58/100
software-mansion/react-native-enriched-html#880 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
software-mansion/react-native-enriched-html#878 ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de software-mansion/react-native-enriched-html
Issues similaires
-
[Android Auto] MU1017 (MHI2Q_JP_AUG22_P1017) cluster map works with a pinned profile — values insideOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
kamgurgul/mib2q-carplay#74 ·
-
Claude:NotNeeded GPT:NotABug triage
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
open5gs/open5gs#5195 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
FriendsofECCE/ECCE#1358 ·
-
documentation needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
X11Libre/xserver#4255 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 84/100
antoxa2584x/nfsu2-sw#52 ·