React Native: text widows, orphans

Viewed 433

React Native only has access to a version of flexbox. How are people handling text widows/ orphans (single word left at the end of the paragraph on a new line alone)?

I've seen some libraries using jQuery but accessing the DOM is obviously not possible. I've also seen some people use CSS nth-child, but again isn't possible on React Native.

I'm currently using the solution String.replace(/\s([^\s<]+)\s*$/,'\u00A0$1'); but it doesn't account for a string with dashes. For example the end of a string might say "7-digit number" where digit is removed from 7-

0 Answers
Related