I'm using React Native 0.29 with Android emulator (API Level 23). I am trying to achieve letterSpacing
on Text
component. But it seems not working on Android. Official documentation says that it only works in iOS. Is there any workaround of this problem?
The lack of letter spacing on Android can be "solved" by adding one or more spaces between each character. I have found the unicode HAIR_SPACE U+200A to give the best results, but you might have to experiment to find what suits best for your font. For example 2 hair spaces or one U+2009 THIN SPACE .
The most common layout of a business letter is known as block format. Using this format, the entire letter is left justified and single spaced except for a double space between paragraphs.
While tracking adjusts the space between characters evenly, regardless of the characters, kerning adjusts the space based on character pairs.
The lack of letter spacing on Android can be "solved" by adding one or more spaces between each character. I have found the unicode HAIR_SPACE U+200A
to give the best results, but you might have to experiment to find what suits best for your font. For example 2 hair spaces or one U+2009 THIN SPACE
.
function applyLetterSpacing(string, count = 1) {
return string.split('').join('\u200A'.repeat(count));
}
It probably works best for headers and menu labels.
Unicode spaces: https://www.cs.tut.fi/~jkorpela/chars/spaces.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With