5 ms·
Neat! Yoga is a great library, I wrote Rust bindings for it: https://github.com/bschwind/yoga-rs?files=1 https://github.com/bschwind/yoga-rs?files=1 I eventua
by bschwindHN 9y ago
Neat! Yoga is a great library, I wrote Rust bindings for it:
https://github.com/bschwind/yoga-rs?files=1 https://github.com/bschwind/yoga-rs?files=1
I eventually want a React Native esque framework but written in Rust instead of JS. Still a ways away though, I don't have much time to work on it.
- seanmcdirmid 9y agoWhat would be the point of having React Native for Rust if Rust itself is already native? Having a DOM API available in Rust?
- bschwindHN 9y agoThe goal would be a higher amount of code sharing and perhaps a more consistent way to organize data and logic across platforms. React Native runs a JS VM in a separate thread and communicates to the native platform code (Java and objective c) to tell it where to draw things. The native code then passes things like touch events back to the JS thread. I want to replace the JS thread with native code to hopefully increase performance and gain advantages from Rust such as its nice type system and the Cargo ecosystem. I have a proof of concept running Tokio and Serde to talk back and forth on Android between Java and Rust but it doesn't do much yet. Needs a lot more time to get anything serious going.
- ch0wn 9y agoThat sounds super cool! I was looking into writing Rust bindings to Yoga myself but then saw your library. I'd love to read a post about what you're doing once you've made sufficient progress with it.
- bschwindHN 9y agoYeah I should probably write a post to get more of the concrete ideas out there, I'm afraid I don't have enough time to work on it right now. However, another contributor to my repo is doing some interesting work with Yoga here (though it's not quite related to cross-platform mobile apps): https://github.com/victorporof?tab=repositories https://github.com/victorporof?tab=repositories I say "contributor" but he's basically the one doing the heavy lifting on the bindings lately
- jankassens 9y agoI would recommend taking a look at Litho (Android) and ComponentKit (iOS). Both frameworks by Facebook and inspired by the React component model for pure native development.
- bschwindHN 9y agoDo they plan on unifying them into one framework, or are the platforms different enough that they've given up on having one framework to do everything?
- ch0wn 9y agoLitho and ComponentKit have similar APIs and we try to bring them closer together, but I'm not sure what unifying them would actually look like. You would still end up with two libraries that target very different languages. React Native is there to stay if sharing logic is more important to you than raw speed.
- bschwindHN 9y agoAh okay, so they share the basic programming ideology but each is a bit more tailored to their target platform. Is that right? The advantage then being that it's easier to write versions for Litho and ComponenentKit than it is to write Java/Kotlin and Objective-C/Swift versions.
- stephth 9y agoWas just reading about yoga. Since you’re familiar with it, do you know if there are plans to support css grid?
- bschwindHN 9y agoI don't think there are any plans to but facebook has so many engineering resources that they may just add it one day. For now it's just Flexbox and I think that covers most developers' needs.
- ch0wn 9y agoI'm not on the Yoga team but work with them quite closely. There are no active plans for adding CSS Grid support mostly because the spec is kind of awkward with the ASCII-art style definitions that are very reliant on CSS as the source language. Personally, I've been warming up to the idea of using CSS Grid for UIs more and more lately after reading this post on Mozilla Hacks[0], but we haven't had many requests for adding it otherwise. [0] https://hacks.mozilla.org/2018/02/css-grid-for-ui-layouts/ https://hacks.mozilla.org/2018/02/css-grid-for-ui-layouts/