Skip to content

Commit

Permalink
Merge pull request #460 from robsco-git/robsco-git-patch-1
Browse files Browse the repository at this point in the history
Don't split words on non-breaking space char
  • Loading branch information
hshoff committed Jul 9, 2019
2 parents c472afd + 6b58fd3 commit 9c028eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vx-text/src/Text.js
Expand Up @@ -25,7 +25,7 @@ class Text extends Component {
// Only perform calculations if using features that require them (multiline, scaleToFit)
if (props.width || props.scaleToFit) {
if (needCalculate) {
const words = props.children ? props.children.toString().split(/\s+/) : [];
const words = props.children ? props.children.toString().split(/(?:(?!\u00A0+)\s+)/) : [];

this.wordsWithComputedWidth = words.map(word => ({
word,
Expand All @@ -46,7 +46,7 @@ class Text extends Component {
}

updateWordsWithoutCalculate(props) {
const words = props.children ? props.children.toString().split(/\s+/) : [];
const words = props.children ? props.children.toString().split(/(?:(?!\u00A0+)\s+)/) : [];
this.setState({ wordsByLines: [{ words }] });
}

Expand Down

0 comments on commit 9c028eb

Please sign in to comment.