Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text's numberOfLines property not respected when non-truncated strings are terminated with a newline character #21406

Closed
3 tasks done
B3rry opened this issue Sep 28, 2018 · 3 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@B3rry
Copy link

B3rry commented Sep 28, 2018

Environment

[skip envinfo]

Verified in the latest release (RN 0.57.0)

Description

When passing a string that terminates in a newline ${'\n'} to a Text component, the number of rendered lines will be one greater than the numberOfLines attribute applied when the string is not truncated due to length.

Reproducible Demo

Some View:

import {Text} from 'react-native'

...

render( ) {
    return (
        <Text numberOfLines={1}>
            {`Line One ${'\n'}`}
        </Text>
    )
}
@B3rry
Copy link
Author

B3rry commented Sep 28, 2018

I was able to temporarily work around this issue by passing a non-breaking space character after the newline:

{`${detail}${'\n\u00A0'}`}

@react-native-bot
Copy link
Collaborator

Can you run react-native info and edit your issue to include these results under the Environment section?

If you believe this information is irrelevant to the reported issue, you may write [skip envinfo] under Environment to let us know.

@react-native-bot
Copy link
Collaborator

I am closing this issue because it does not contain the necessary environment info, and there has been no followup in a while.

If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.

@facebook facebook locked as resolved and limited conversation to collaborators Oct 6, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants