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 #21612

Closed
3 tasks done
B3rry opened this issue Oct 9, 2018 · 4 comments
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@B3rry
Copy link

B3rry commented Oct 9, 2018

Environment

[skip envinfo]

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 Oct 9, 2018

Resubmitting this issue, because @react-native-bot failed to detect the [skip envinfo] update. The original ticket is #21406

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

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

@stale
Copy link

stale bot commented Jan 20, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 20, 2019
@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 24, 2019
@hramos hramos removed the Bug Report label Feb 6, 2019
@stale
Copy link

stale bot commented Aug 2, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 2, 2019
@stale
Copy link

stale bot commented Aug 9, 2019

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.

@stale stale bot closed this as completed Aug 9, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

3 participants