Word Spacing in React Native

2.4k views Asked by At

We use letterSpacing for spacing between letters

L i k e t h i s

What if we want word spacing in react native?

Like [space] this

1

There are 1 answers

0
jlblca9l_kpblca On

Here is my workaround. I have an inline Text element between the words that contains two zero-width non-breaking spaces and a letterSpacing property.

React Native treats those spaces as characters and renders the letter spacing between them, while the characters themselves don't contribute to the width of the spacing.

<Text>
    Like
    <Text style={{letterSpacing: 16}}>&#xFEFF;&#xFEFF;</Text>
    this
</Text>