-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Inconsistent text wrap behavior with flexbox #1730
Comments
There are a couple of related things here:
@kzlar is there any way you could repro this against RN new arch (default in RN 0.76/Expo 52)? It goes through different measurement path. |
For #2, there's a good chance on Android that we aren't filling bounds of multiline text ala web in this logic https://github.com/facebook/react-native/blob/94fdc388220399d22ee2ada76b7aed847d8c0eea/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java#L661 |
Oh wah, thanks @s77rt! I had also looked into @kzlar issue and did not understand why the first text was fitting it's container; now it's clear! It's actually not affected by Second text is actually the standard, using the |
@delphinebugner Since we are using less width than what we have allocated we may have unfilled space (even with |
@s77rt when I looked at behavior on web, sizing explicitly to fit-content, wrapped paragraph took full available width instead of width of max line. So, when we shrink, we only shrink to amount of space needed to also add inflexible child. Ie in top example, yellow inflexible child should hug the right. So I think measure function logic in RN needs to be changed to return available width when text is wrapped, instead of longest line width. Separately, Yoga should be calculating initial flex basis as max content instead of fit-content, but that’s a gnarlier bug. |
Ah I got it. It does make sense in a way and it's consistent with web. Will look into this one then |
Report
Issues and Steps to Reproduce
Snack Repro: https://snack.expo.dev/@meata/text-bug?platform=ios
Select the iOS preview.
The gist is this: I have a horizontal stack with two text fields, when the first field gets too long I expect it to wrap and take the minimum width it can. This doesn't seem to be the case, worse, it seems to behave differently depending on the number of letters in the first field. The first section shows the behavior I expect, the second is the weird behavior. With both the total width is the same, only difference is the additional letter.
Same issue can be observed on Android but the text needs to be changed a bit to make it work.
On web it at least seems consistent, even though I'm not sure why it does not shrink.
Expected Behavior
Explained above, but generally I expect it to at least behave consistently (either shrink or don't)
Actual Behavior
Explained above, adding a single character changes the layout from shrinking to not shrinking.
Link to Code
https://snack.expo.dev/@meata/text-bug?platform=ios
The text was updated successfully, but these errors were encountered: