-
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
[Feature] Support CSS Grid #867
Comments
I'd like to voice my support. |
Great! Just give it a positive reaction like many others have done :) (That goes for anyone else that has an itch to make a +1 comment) |
Is anyone aware of other efforts to make a cross-platform implementation of CSS Grid? I would love to support this. It's worth remembering that CSS Grid has a larger API surface area than Flexbox, so adding it here would be quite an undertaking and a big change to Yoga. Maybe a way forward would be a separate project which could serve as a reference or proof of concept. |
+1 to get CSS Grid as part of Yoga (and potentially part of React-Native) |
I would like that |
Any update on this? |
Please, this would be huge. Since most browsers support this in some way, we're starting to use CSS grid as a standard in our React dev. Would be great to be in sync with RN dev. |
@RodRitter same problem for me. |
Some of you might be interested to know about a year ago an alternative was announced called Stretch:
And 9 months ago, HackerNews thread, author replies:
Website: https://vislyhq.github.io/stretch/ While it's probably of no use to the majority here that probably want CSS Grid to land in yoga for usage in React-Native, anyone that would be open towards Almost a year in since creating this issue, it would be fantastic to hear back from a dev of this project, if there is any hope for seeing Grid support arrive in future. |
Agreed!
It’s much harder to share components between web and native if we can’t use grid for component layout in one, when it’s such a lovely feature of making components on the web now.
…Sent from my iPhone
On 10 Feb 2020, at 09:55, Rod Ritter ***@***.***> wrote:
Please, this would be huge. Since most browsers support this in some way, we're starting to use CSS grid as a standard in our web dev. Would be great to be in sync with RN dev.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Any news on this? 🙏🏼 |
The mentioned stretch project recently started discussing how to start implementing Grid support. Doesn't seem like there's any interest from devs on yoga. Perhaps at a later date it may be possible to substitute yoga for stretch? Just subscribe to the issue if you haven't already and you'll be informed of any news. No need to notify everyone with a new message asking, we see the same issue thread content as you 👀 Let's try avoid requests for updates, cheers 👍 |
sometimes playing with flexbox to make grid like design make a component really heavy. and it impact performance inside react native |
I'm fairly used to use CSS Grid instead of Flexbox in web development. Lack of support for CSS Grid is a deal-breaker to me. |
i hope stretch substitute for yoga. |
Would be a great addition |
Update in 2020? Ooops it's almost 2021 |
Update in 2021 ? 2022 will be come |
hey yoga team is there any plan to support this feature. or would you mind to please open a proposal for it. Thanks |
Commenting here for the sole purpose of asking for updates or expressing interest doesn't serve any purpose or provide any value than all those that have done the same before you. Please refrain from this behaviour.It just annoys all those who are subscribed for notifications and actually hoping to see an update with positive news. Before adding a comment and notifying everyone here, please consider the following:
Someone has to want the feature enough to devote the time into making it happen and that likely won't happen without decent financial backing / incentive. The best we can do is show demand for it as users (as described above)..... and be patient. Alternatively setup a bounty and pool funds into that. |
@polarathene Ok, got it. sorry for that 😉. |
@TheEhsanSarshar I would not say there's no traction on this, we have 600+ emoji on the top post. For any team who built its web-application on css-grid feature, having react-native not supporting it is a deal breaker (and btw I seriously don't see any reason to create layouts with flex in 2021, beyond supporting IE11). But if the yoga team is not considering this feature, a clean statement like "we are not working on this in the foreseeable future" would be much appreciated when closing this issue! 🙃 |
A bit of an update for everyone on this issue:
Stretch was forked as Taffy in May 2022 under the auspices of the bevy and dioxus projects, and is now seeing regular maintenance, as well as new feature development work. It should be noted that unlike Stretch, Taffy does not currently have bindings to languages other than Rust. However, we are open to adding them, and would welcome contributors interested in developing and maintaining such bindings (and we'd be able to provide mentorship on the Rust side of things).
Also relevant to this issue: we have an in-progress implementation of CSS Grid! The CSS Grid implementation is mostly feature complete at this point, but there are still a few bits of functionality (like baseline alignment) and a lot of testing that needs to happen before we are ready to put out a stable release. For those of you who are interested in using a CSS Grid implementation as a library in their own (non react-native) projects, we have put out an alpha release that you could play with today. And you can track the progress of the CSS Grid implementation in tracking issue (DioxusLabs/taffy#204) Those who are looking CSS Grid support in React Native specifically may be interested in RFC: Vision for Layout Conformance/Parity, which sets out React Native's vision for layout going forwards. As you can see, they have considered Taffy, but are not planning to adopt it in React Native. I also had some further discussion with @NickGerleman (who has recently taken over maintenance of Yoga, and has already been implementing some welcome and long overdue improvements to things like the build system) where it was explained that the primary reason for this is a strong commitment to bug-for-bug backwards compatibility in React Native's layout engine (on the basis that bugs caused by changes in layout will likely be silent and hard to detect) and a belief that it will be hard to maintain that if switching to a new layout engine (a belief I am inclined to agree with FWIW). Thus, in terms of getting CSS Grid support into React Native, it seems like the best path forwards may be porting Taffy's implementation into Yoga. This is by no means a small task, and would involve refactoring the existing Flexbox implementation to interoperate with another layout algorithm (while maintaining bug-for-bug compatibility with the existing implementation - possibly behind a flag), as well as implementing the grid algorithm itself. But I think it is achievable with enough effort, and it would be aided by the fact that Taffy is a derivative of Yoga and that the structure of the two projects is still largely similar. |
It would be amazing to see this materialize. CSS Grid is something the React Native ecosystem has wanted for a long time, and this thread has many other users of Yoga who would benefit from it as well. I have also suspected CSS Grid would be a valuable enough addition to React Native that we could use it as a tool to start driving users to migrate their apps to conformant behavior. As I'm sure you can tell by the other thread "how can we do this safely" is very top-of-mind. These sorts of shifts have to be done piecemeal, but I do think we have concrete ways to do them. E.g. WPT fixtures for validating the conformance of new changes, or perf testing for any sort of major algorithm change (I don't have confidence the current tests would catch many real-world issues here).
My ideal would be for Yoga to be conformant by default. The fear of behavior changes has been a stall on Yoga's development that we need to move past, but we need to be smart about it. The model I have been exploring for that is that we:
Have some work drafted to start doing this for 7e96b65, adding There are also some apps and frameworks inside of Meta which depend on the latest Yoga, but are no longer being actively developed. They won't see any benefit from the new things happening, and are one of the larger risk-areas to our own usage since they are more eyes-off, so I have been working to see if I can freeze them on an older version of Yoga to give a little bit more breathing room to make changes. |
The stable 0.3 release of Taffy with CSS Grid was released yesterday. So it's now ready both for production usage, and for porting should anyone wish to take that on.
It has occured to me that the first step towards supporting CSS Grid in Yoga would be refactoring the flexbox implementation such that when it needs to measure children it is able to call into another algorithm rather than always calling recursively into itself. And if we're making this change anyway, I'm wondering if it would make sense to duplicate the flexbox algorithm into "legacy flexbox" (frozen in the current state) and "modern flexbox" (where we could go to town on the breaking changes - perhaps with an effort to get it quite close to standards compliant for the first release so that the breaking changes are mostly a one-off rather than an ongoing thing). This might be simpler than trying to feature flag everything on a fine-grained level... Taffy uses this trait for this purpose, and in C++ you'd presumably want to use an interface. Making the algorithm logic generic over an interface provides two other benefits:
Taffy offers both a low-level API where the user of the library implements the above trait and handles things like caching and tree iteration logic themselves and a high-level API akin the one Yoga currently offers. |
@nicoburns how can someone use taffy in react-native? It's not completely clear to me. |
Report
It's been advised to open a new issue (from this closed issue from 2015). Related react-native issue
It's been 4 years since the issue was closed. This issue is to request evaluating if supporting
display: grid
is worth reconsidering now.It is the
11th8th top request(1st in regards to layout,8th3rd trending) at229(Mar 2019)359(Feb 2020) votes on React-Native feature requests, the feature request was created in December 2017 with steady response of support from users since then.The text was updated successfully, but these errors were encountered: