Skip to content

Text component adds a linebreak when string content is equal to width of component #15893

Closed
@nathanielram

Description

@nathanielram

Is this a bug report?

Yes.

Have you read the Contributing Guidelines?

Yes.

Environment

  1. react-native -v: 0.45.1
  2. node -v: v6.10.3
  3. npm -v: 3.10.10
  4. yarn --version: 1.0.1

Then, specify:

  • Target Platform: Android & iOS
  • Development Operating System: macOS 10.12.5
  • Build tools: react-native run-ios & react-native run-android

Steps to Reproduce

  1. Add a Text component anywhere in project (add another component underneath it or use a border - needed to see the issue)
  2. 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
  3. The text will introduce an unwanted linebreak without any characters moving with it, creating a new blank line with no text

Expected Behavior

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.

Reproducible Demo

I have managed to reproduce the issue on both Android & iOS:
https://snack.expo.io/S1EhNIVqb

Since the sizes of the screens on the two devices is different, I had to make slightly different examples for both, but the problem is the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions