nodegui / react-nodegui

Build performant, native and cross-platform desktop applications with native React + powerful CSS like styling.🚀
https://react.nodegui.org
MIT License
6.18k stars 171 forks source link

StyleSheets like React Native (for tooling interoperability) #352

Open skotchpine opened 3 years ago

skotchpine commented 3 years ago

Having the same (or similar) APIs to react native means we can share tooling. In my case, I'd like to use react-native-tailwindcss, but can't

I'd like to be able to use javascript objects to style components, like react native does (though the features shouldn't be 100% same, probably.

Is it reasonable? How would we implement this?

Solant commented 3 years ago

Hi

I did something similar to RN stylesheets here: https://github.com/Solant/nodegui-stylesheet You can create a main stylesheet with all reused utility classes

However, there are some differences between regular CSS, RN styles, and Qt CSS, so they won't be 100% compatible

edit: Also there are some new pseudo-elements presented from Qt: https://doc.qt.io/archives/qt-4.8/stylesheet-syntax.html (like QComboBox::down-arrow) so sometimes you just have to get back to plain/inline CSS stylesheets

skotchpine commented 3 years ago

That's pretty close to what I was looking for.

I'll see how I can get around the unit function and avoid actually calling create.