-
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
Margin auto allows negative values #978
Comments
Hi @jacobp100 Thank you for reporting this. I just pushed a PR for that bug fix. |
Amazing. Thanks so much! |
@NickGerleman is this something you'd be willing to accept a PR for Yoga 3? Or is it unlikely to get accepted if it'll break things at Meta |
I’d be willing to give it another go. I’ve been leaning a bit on merging things where existing coverage doesn’t show lots of product changes, and this one might not be too bad. |
I think it's literally just these two lines https://github.com/facebook/yoga/blob/main/yoga/algorithm/CalculateLayout.cpp#L1046 Need a |
Summary: Fixes facebook/yoga#978 1. Don't allow auto margin spaces to become a negative length 2. Replicate fallback alignment behavior specified by box-alignment spec that we are using for align-content. Differential Revision: D56091577
Summary: Fixes facebook#978 1. Don't allow auto margin spaces to become a negative length 2. Replicate fallback alignment behavior specified by box-alignment spec that we are using for align-content. Differential Revision: D56091577
…rs (facebook#1646) Summary: X-link: facebook/react-native#44069 Fixes facebook#978 1. Don't allow auto margin spaces to become a negative length 2. Replicate fallback alignment behavior specified by box-alignment spec that we are using for align-content. Reviewed By: joevilches Differential Revision: D56091577
…rs (facebook#44069) Summary: X-link: facebook/yoga#1646 Fixes facebook/yoga#978 1. Don't allow auto margin spaces to become a negative length 2. Replicate fallback alignment behavior specified by box-alignment spec that we are using for align-content. Reviewed By: joevilches Differential Revision: D56091577
…rs (#44069) Summary: X-link: facebook/yoga#1646 Pull Request resolved: #44069 Fixes facebook/yoga#978 1. Don't allow auto margin spaces to become a negative length 2. Replicate fallback alignment behavior specified by box-alignment spec that we are using for align-content. Reviewed By: joevilches Differential Revision: D56091577 fbshipit-source-id: 3c02f81f969bb947cdc5c80b15faaa0b0d39c0c2
…rs (#1646) Summary: Pull Request resolved: #1646 X-link: facebook/react-native#44069 Fixes #978 1. Don't allow auto margin spaces to become a negative length 2. Replicate fallback alignment behavior specified by box-alignment spec that we are using for align-content. Reviewed By: joevilches Differential Revision: D56091577 fbshipit-source-id: 3c02f81f969bb947cdc5c80b15faaa0b0d39c0c2
I think the change will stick, but fixing |
Report
Issues and Steps to Reproduce
Create a setup like follows
Or use playground link
Expected Behavior
The bottom view should overflow the parent (as happens on the web)
Actual Behavior
The bottom view gets a negative top margin applied, and overlaps the top view. Nothing overflows the parent
Link to Code
https://yogalayout.com/playground?eyJ3aWR0aCI6NTAwLCJoZWlnaHQiOjUwMCwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwiZmxleERpcmVjdGlvbiI6MCwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiY2hpbGRyZW4iOlt7IndpZHRoIjoiIiwiaGVpZ2h0IjoiMzAwIiwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFNocmluayI6IjAifSx7IndpZHRoIjoiIiwiaGVpZ2h0IjoiMzAwIiwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwibWFyZ2luIjp7InRvcCI6ImF1dG8ifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFNocmluayI6IjAifV19
Notes
If you remove
marginTop: auto
you get the correct behaviourI did find these few lines
I'm not sure what the logic of
remainingFreeSpace
is - if it should allow negative values or not. If it does allow them, it might just need amax(0, ...)
The text was updated successfully, but these errors were encountered: