fix: Set white-space to pre for single-line Text#2058
Closed
evancharlton wants to merge 1 commit intonecolas:masterfrom
evancharlton:white-space-pre
Closed
fix: Set white-space to pre for single-line Text#2058evancharlton wants to merge 1 commit intonecolas:masterfrom evancharlton:white-space-pre
evancharlton wants to merge 1 commit intonecolas:masterfrom
evancharlton:white-space-pre
Conversation
By default, the Text component is rendered with `white-space: pre-wrap`
in order to keep meaningful whitespace behavior. When a Text component
had `numberOfLines={1}` set, word-wrapping was disabled by changing it
to specify `white-space: nowrap`.
However, `nowrap` removes the meaningful whitespace behavior. Instead,
use the `pre` value to maintain the leading and trailing whitespaces of
strings.
Source: [MDN's white-space page][white-space docs]
[white-space docs]: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space
necolas
pushed a commit
that referenced
this pull request
Jun 17, 2021
Preserve meaningful white-space when `numberOfLines={1}` by using the `pre` value instead of `nowrap`.
Source: [MDN's white-space page][white-space docs]
[white-space docs]: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space
Close #2058
rnike
pushed a commit
to VeryBuy/react-native-web
that referenced
this pull request
Sep 13, 2022
Preserve meaningful white-space when `numberOfLines={1}` by using the `pre`
value instead of `nowrap`.
Source: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space
Close necolas#2058
rnike
pushed a commit
to VeryBuy/react-native-web
that referenced
this pull request
Sep 13, 2022
Reverts the change made for necolas#2058, which is considered an avoidable edge-case. Fix necolas#2243
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By default, the Text component is rendered with
white-space: pre-wrapin order to keep meaningful whitespace behavior. When a Text component
had
numberOfLines={1}set, word-wrapping was disabled by changing itto specify
white-space: nowrap.However,
nowrapremoves the meaningful whitespace behavior. Instead,use the
prevalue to maintain the leading and trailing whitespaces ofstrings.
References: MDN's white-space page