-
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
Gap/row-gap/column/gap properties #812
Comments
I'd like to resurface this issue as the |
Yep, this really is one of the final missing pieces in most "flexbox" implementations. Having to balance out margins for inner elements, which sometimes change position etc., is really not a fun experience. |
I think this should get revisited as well. Flex gap has landed in stable for both chrome and firefox: https://caniuse.com/flexbox-gap |
Would be nice to have this as browser support grows. |
Update: it landed in webkit too: https://bugs.webkit.org/show_bug.cgi?id=206767 |
I suggest renaming the issue to "Support gap property" to reflect changes to the name. By the way Safari Technology Preview also supports gap now. |
It's seems like the gap properties is supported in modern browsers. I think this issues should be review again. |
Gap just dropped in Safari too. |
Any updates on this? |
Created a draft PR on React native repo which includes gap related changes. Feedbacks are welcome 😄 facebook/react-native#32766 |
It looks promising! You'd need to do the PR here. I did have a stab at it, and there's a few differences:- You'll need to add tests - the cpp files (here) are generated from html (here). They're run through Chrome to get the layouts, so it's very automatic. I didn't think about doing this in getLeadingMargin. If that works, it makes it so much simpler. Let me know how the tests go! I structured the gap like borders:- Lines 78 to 88 in 578d197
You'd end up with a gap property that would be an array of row and column. The advantage of this was you'd be able to set |
But this is really cool to see! Really glad to have someone else working on it because I hit a brick wall with it. Happy to help out too. |
yeah, basically thought of getting row/column gap first. Gap would be simpler on top of it, will be a good addition! (regarding using margins -> Just thought about it today 😅 , earlier I was trying a different approach which got complicated ) |
Yeah I found building the project is quite hard too. Now I've replaced my laptop with an M1 and it seems like a no-go atm 😔 |
Just managed to build and run tests in m1 (using rosetta for now). This is what I did to install. (this needs to be done on rosetta terminal)
Post install, I needed to do the following change because I installed latest chromedriver. When I ran Interestingly when I generate tests from gentest.rb, I see some values change in tests, and three tests start failing. Not sure why (could be because I am using new chromedriver and browser behaviour changed (sounds unlikely)). This is without any gap-related changes. Investigating it further. |
Ah amazing! I’ll give it a shot |
I also got layout changes running it without changes on my old Intel machine |
@intergalacticspacehighway I'm stuck with openjdk Error: openjdk@8: no bottle available!
You can try to install from source with:
brew install --build-from-source openjdk@8
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew's GitHub, Twitter or any other
official channels. If I run that command, it installs a load of packages successfully, but then fails here, ==> Installing openjdk@8
==> common/autoconf/autogen.sh
==> ./configure --with-boot-jdk-jvmargs=-Duser.home=/Users/jacob/Library/Caches/Homebrew/java_cache --with-boot-jdk=/private/tmp/openjdkA8-20211219-60748-3o4zoe/jdk8u312-ga/boot-jdk --with-debug-level=release --wit
==> make bootcycle-images CONF=release
Last 15 lines from /Users/jacob/Library/Logs/Homebrew/openjdk@8/03.make:
2021-12-19 10:14:35 +0000
make
bootcycle-images
CONF=release
No configurations found for /private/tmp/openjdkA8-20211219-60748-3o4zoe/jdk8u312-ga/! Please run configure to create a configuration.
Makefile:55: *** Cannot continue. Stop.
READ THIS: https://docs.brew.sh/Troubleshooting
These open issues may also help:
openjdk@8: depend on awk https://github.com/Homebrew/homebrew-core/pull/89982
openjdk@11 11.0.13 https://github.com/Homebrew/homebrew-core/pull/87638
OpenJDK is somewhat broken on newer MacOS instances, console is flooded with errors when using JMeter, AdoptOpenJDK has no issues https://github.com/Homebrew/homebrew-core/issues/66953 |
This is weird. Can you try this command? (also make sure it's rosetta terminal 😅 )
Also, found an inconsistency in one of the failing tests. |
I did run that - no issues, it successfully installed. But it didn’t fix |
Okay. Can you try two more things.
|
Ah you're right - I wasn't using Rosetta. Ok so now I get a different error,
I installed brew on arm64. I think stuff has got into a bit of a mess, so I'm gonna uninstall and re-install brew. Did you install brew under Rosetta or native arm64? And do you have your install command? |
Sorry it's a bit mess. I should've taken proper notes. I think I followed this instruction Also, created this issue. I think I'll ignore this issue for now and test with gap-related cases. |
I've started my branch for gap over here - https://github.com/jacobp100/yoga/tree/gap So far just in process the proper infrastructure so you can set |
Thanks for your help! Buck is now running. I'm getting the same as you for tests - but I'm sure that's just the tests haven't been run in a while. Will let you know how I get on with the gap stuff. |
Awesome. I forgot to mention you that I've implemented gap on the same react native draft PR. These are the changes for Yoga. Let me know what you think about this approach. Will be adding testcases. |
I think there's an issue using // returns the YGNodeRef that owns this YGNode. An owner is used to identify
// the YogaTree that a YGNode belongs to. This method will return the parent
// of the YGNode when a YGNode only belongs to one YogaTree or nullptr when
// the YGNode is shared between two or more YogaTrees.
YGNodeRef getOwner() const { return owner_; } |
I think it would be an issue Using Btw also found an issue with margin implementation when parent has fixed height. Debugging it. I have a fair idea of what's wrong but not able to pinpoint it. I hope to solve it today. Btw if you have an alternate gap implementation, I am happy to test it. We can go with whichever works best. |
Yeah I've noticed an issue with 'auto' margins where they can become negative (when they should be clamped to zero). I was gonna look into it - but I suspect it'll need a feature toggle or a whole lot of layouts are gonna break I don't think the owner is 1:1 with a parent - I assume this enabled some kind of optimisation for recalculating layouts or something like that. |
@intergalacticspacehighway I've done a PR over here - #1116 |
Awesome! Will test it soon 🥳 |
This is now implemented (see #1116) |
@NickGerleman thanks for taking this on! |
Huge congrats to @jacobp100 and @intergalacticspacehighway for pushing this through. A lot of people are very excited for it to be released 🙂. https://twitter.com/reactnative/status/1613584810223570952?s=46&t=nSxqL7Mt7r6wQFEk4snH9A |
Report
In the drafts of box alignment level 3, there's the properties
row-gap
andcolumn-gap
that allow the user to specify the gaps between rows and columns.It is a draft, so it might be premature to implement now. Do we want to support this now? (I can take a shot at it if I get time!)
The text was updated successfully, but these errors were encountered: