Skip to content

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

@B3rry

Description

@B3rry

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>
    )
}

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions