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 numberOfLines prop is not respected in Nested Text #22811

Closed
3 tasks done
mloureiro opened this issue Dec 27, 2018 · 4 comments
Closed
3 tasks done

Text numberOfLines prop is not respected in Nested Text #22811

mloureiro opened this issue Dec 27, 2018 · 4 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@mloureiro
Copy link

mloureiro commented Dec 27, 2018

name: 🐛 Bug Report
about: Report a reproducible bug or regression in the core React Native library.

Environment

[skip envinfo]
This is reproducible in the expo playground

Description

Property numberOfLines is not respected when used in a child Text component:

<Text>
  <Text  numberOfLines={1}>{'sometext'.repeat(1000)}</Text>
</Tex>

In this #4733 (comment) @oureta mentions that this does not work, I don't understand if it is expected behavior, or a 🐛

According to Text doc the styling has some limitations with inheritance/nesting, although nothing is specified (AFAICT) about the other properties.

Reproducible Demo

https://snack.expo.io/H1IZHzGbN

@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.

@bartolkaruza
Copy link

bartolkaruza commented Dec 29, 2018

This will be difficult to implement on Android, as the nested text is represented by a single TextView on which the maxLines and singleLine props are set to implement numberOfLines at the native level. You can check out that code here. The nested text is represented by a span which does not have those properties. I'm not sure how hard it would be to implement on iOS, but I imagine similar issues will be there.

This should probably be added to the known issues section of the Text component doc. @mloureiro do you feel up to making a PR for that on https://github.com/facebook/react-native-website using the template from here?

@mloureiro
Copy link
Author

mloureiro commented Dec 29, 2018

Will do.

PR: facebook/react-native-website#724

risenforward pushed a commit to risenforward/proactive-web that referenced this issue Jan 4, 2019
This feature is difficult to implement at the native level.

Original issue: facebook/react-native#22811

Signed-off-by: Marcos Loureiro <mloureiro.dev@gmail.com>
@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.

@react-native-bot react-native-bot added the Ran Commands One of our bots successfully processed a command. label Jan 6, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Jan 6, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jan 6, 2020
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

3 participants