letterSpacing property not working properly
Personne n'a encore pris cette issue.
- Langage dominant
- C++
- Étoiles
- 127k
- Forks
- 25.3k
- Merge moyen
- 1 j 23 h
- PR mergées (30 j)
- 4
Description
Description
When Applying the letterSpacing to style in Text component, it applies the spacing after the character instead of adding space between the characters.
Here is the sample vanila code.
<Text
style={{
backgroundColor: 'blue',
color: 'white',
fontSize: 18,
alignSelf: 'center',
letterSpacing: 30,
fontVariant: ['tabular-nums'],
}}
>
1/3
</Text>
Output:
I also tried to apply the fontVariant: ['tabular-nums'], assuming that it may keep the character width same if that's the issue.
But seems that doesn't fix the error.
And this gap keeps increasing when you increase the letterSpacing.
Try 2:
<Text
style={{
backgroundColor: 'blue',
color: 'white',
fontSize: 18,
alignSelf: 'center',
letterSpacing: 90, // <- increased
fontVariant: ['tabular-nums'],
}}
>
1/3
</Text>
Output:
And thus How I conclude that it may adds the space after each character instead of gap.
Here is my package.json file's dependencies.
"dependencies": {
"@medusajs/js-sdk": "2.8.7",
"@medusajs/types": "2.8.7",
"@react-native-clipboard/clipboard": "^1.16.3",
"@react-native-community/geolocation": "^3.4.0",
"@react-native-documents/picker": "^11.0.0",
"@react-native-documents/viewer": "^2.0.2",
"@react-native-firebase/analytics": "^23.4.1",
"@react-native-firebase/app": "^23.4.1",
"@react-native-firebase/crashlytics": "^23.4.1",
"@react-native-firebase/remote-config": "^23.4.1",
"@react-navigation/bottom-tabs": "^7.4.6",
"@react-navigation/drawer": "^7.5.7",
"@react-navigation/native": "^7.1.17",
"@react-navigation/native-stack": "^7.3.25",
"@shopify/flash-list": "^2.1.0",
"@tanstack/react-query": "^5.85.2",
"dayjs": "^1.11.19",
"formik": "^2.4.9",
"i18next": "^25.5.2",
"jwt-decode": "^4.0.0",
"lodash": "^4.17.21",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"qs": "6.12.0",
"react": "19.1.0",
"react-i18next": "^15.7.3",
"react-native": "0.80.2",
"react-native-config": "^1.5.6",
"react-native-fast-image": "^8.6.3",
"react-native-flash-message": "^0.4.2",
"react-native-gesture-handler": "^2.28.0",
"react-native-image-crop-picker": "^0.51.1",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-keyboard-controller": "^1.19.6",
"react-native-linear-gradient": "^2.8.3",
"react-native-mmkv": "^3.3.0",
"react-native-navigation-bar-color": "^2.0.2",
"react-native-otp-entry": "^1.8.5",
"react-native-permissions": "^5.4.4",
"react-native-reanimated": "^4.0.2",
"react-native-reanimated-carousel": "^4.0.3",
"react-native-render-html": "^6.3.4",
"react-native-safe-area-context": "^5.6.0",
"react-native-screens": "^4.14.1",
"react-native-svg": "^15.12.1",
"react-native-video": "^6.16.1",
"react-native-worklets": "^0.4.1",
"yup": "^1.7.1",
"zustand": "^5.0.7"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@commitlint/cli": "^19.8.1",
"@commitlint/config-conventional": "^19.8.1",
"@react-native-community/cli": "19.1.1",
"@react-native-community/cli-platform-android": "19.1.1",
"@react-native-community/cli-platform-ios": "19.1.1",
"@react-native/babel-preset": "0.80.2",
"@react-native/eslint-config": "0.80.2",
"@react-native/metro-config": "0.80.2",
"@react-native/typescript-config": "0.80.2",
"@tanstack/eslint-plugin-query": "^5.83.1",
"@types/jest": "^29.5.13",
"@types/lodash": "^4.17.20",
"@types/react": "^19.1.0",
"@types/react-test-renderer": "^19.1.0",
"babel-plugin-module-resolver": "^5.0.2",
"cspell": "^9.3.2",
"eslint": "^8.19.0",
"eslint-plugin-import": "^2.32.0",
"husky": "^9.1.7",
"jest": "^29.6.3",
"lint-staged": "^16.1.5",
"prettier": "2.8.8",
"react-native-dotenv": "^3.4.11",
"react-test-renderer": "19.1.0",
"reactotron-react-native": "^5.1.15",
"typescript": "5.0.4"
},
Steps to reproduce
- Just paste the code blocks I added in the react native project created with same version as mine.
React Native Version
0.80.2
Affected Platforms
Runtime - Android, Runtime - iOS
Output of npx @react-native-community/cli info
info Fetching system and libraries information...
System:
OS: macOS 26.1
CPU: (10) arm64 Apple M4
Memory: 162.77 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.11.0
path: ~/.nvm/versions/node/v22.11.0/bin/node
Yarn:
version: 3.2.3
path: ~/.nvm/versions/node/v22.11.0/bin/yarn
npm:
version: 10.9.0
path: ~/.nvm/versions/node/v22.11.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.16.2
path: /Users/aditya/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.1
- iOS 26.1
- macOS 26.1
- tvOS 26.1
- visionOS 26.1
- watchOS 26.1
Android SDK: Not Found
IDEs:
Android Studio: 2025.1 AI-251.26094.121.2512.13840223
Xcode:
version: 26.1.1/17B100
path: /usr/bin/xcodebuild
Languages:
Java:
version: 21.0.8
path: /usr/bin/javac
Ruby:
version: 2.7.5
path: /Users/aditya/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli":
installed: 19.1.1
wanted: 19.1.1
react:
installed: 19.1.0
wanted: 19.1.0
react-native:
installed: 0.80.2
wanted: 0.80.2
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
info React Native v0.82.1 is now available (your project is running on v0.80.2).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.82.1
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.80.2&to=0.82.1
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".
Stacktrace or Logs
Not a crash
MANDATORY Reproducer
https://snack.expo.dev/@aditya_thummar/moody-indigo-yogurt
Screenshots and Videos
Guide de contribution
Ouvrir le 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.
Piste de recherche
Reproduisez le rapport avec le Snack lié et les exemples du composant Text sur Android et iOS, en essayant des valeurs de letterSpacing de 30 et 90. Suivez le chemin de rendu de Text afin de déterminer pourquoi un espacement apparaît après les caractères, puis vérifiez que les espaces rendus correspondent au comportement attendu de letter-spacing.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- react-native
- Domaine
- mobile
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100