Text component adds a linebreak when string content is equal to width of component
See original GitHub issueReact Native version:
React Native Environment Info:
System:
OS: macOS 10.15.1
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 164.17 MB / 16.00 GB
Shell: 3.0.2 - /usr/local/bin/fish
Binaries:
Node: 12.4.0 - /usr/local/bin/node
Yarn: yarn install v0.21.3
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.46s. - /usr/local/bin/yarn
npm: 6.11.3 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 26, 27, 28
Build Tools: 27.0.3, 28.0.0, 28.0.3
System Images: android-26 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 11.2.1/11B53 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz => 0.59.8
npmGlobalPackages:
eslint-plugin-react-native: 3.2.1
react-native-cli: 2.0.1
Steps To Reproduce
- Add a Text component anywhere in project (add another component underneath it or use a border - needed to see the issue)
- Add some text to get it to reach the exact width of the Text component - this may take a few attempts as not all characters have the same width and may require using some punctuation as well
- The text will introduce an unwanted linebreak without any characters moving with it, creating a new blank line with no text
Describe what you expected to happen: Some text should either wrap to the new line or a new line should not be created.
Actual Behavior On both iOS & Android, when the length of the text string is the width of the Text component, it adds a linebreak, creating extra space below text elements.
My guess is that there’s some sort of improper rounding happening with float density pixels or something.
Snack, code example, screenshot, or link to a repository: https://snack.expo.io/@shamilot/text-early-line-wrap
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Text component adds a linebreak when string content is equal ...
On both iOS & Android, when the length of the text string is the width of the Text component, it adds a linebreak....
Read more >How can I insert a line break into a <Text> component in ...
There are two main solutions for this. Method 2: Add the line break it in the string literals, like below. For more information,...
Read more >word-break - CSS: Cascading Style Sheets - MDN Web Docs
The word-break CSS property sets whether line breaks appear wherever the text would otherwise overflow its content box.
Read more >Injecting a Line Break | CSS-Tricks
I had a little situation where I had a header with a span in it, and I wanted to make sure to put...
Read more >Label - .NET MAUI | Microsoft Learn
NET MAUI) Label displays single-line and multi-line text. Text displayed by a Label can be colored, spaced, and can have text decorations.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there any way to get some eyes on this? It’s a major bug and it has been largely ignored.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.