9
<Text>
Aufmerksamkeits{'\u00AD'}defizit
</Text>

This leads iOS to

Aufmerksamkeits-
defizit

But on Android to

Aufmerksamkeitsd
efizit

So it seems that Android ignores the given soft hyphen. How can I make this work on Android as well?

AmerllicA
  • 29,059
  • 15
  • 130
  • 154

2 Answers2

3

I now it is a bit late, but I spent more time on this than I am proud of. If you want to use soft hyphen use \u00AD in strings, e.g.:

<string name="einzelfahrt_name">Einzelfahrrad\u00ADkarte</string>

In order to make this working though, in your TextView, you have to add:

android:hyphenationFrequency="full"
APTower
  • 343
  • 2
  • 8
  • where one need to add "android:hyphenationFrequency"? please provide example – CodeBy Aug 10 '21 at 11:19
  • In React Native this option should be set as a property: `Einzelfahrrad\u00ADkarte` This worked for me! But make sure you have React Native version above the 0.65. – Denis Oct 29 '21 at 17:24
1

I have the same problem and it seems that Android ignores soft hyphens.

The only workaround I could think of is, only on Android, to replace the \u00AD with \u200B. It's known as zero-width-space, and it would properly break the words where expected, although it would not show any hyphenation character. You would end up with:

Aufmerksamkeits
defizit

Not the perfect solution, but at least it will not break words at random positions.

Bruno
  • 148
  • 8