Replies: 5 comments 10 replies
-
I had never heard of it until you opened this discussion, so I can't really say other than by looking at their readme. Looks like a nice project. Seems to lean heavily towards a babel plugin / styled-components type mindset. Would be interested to hear from people who have used both libraries. |
Beta Was this translation helpful? Give feedback.
-
Hi @younes0, creator of NativeWind. The biggest difference between the two libraries are core implementation. tailwind-react-native-classnames uses a custom Tailwind compiler that parses strings into RN objects at runtime. nativewind uses the Tailwind compiler to parse strings into RN objects at build time. Some advantages of a runtime compiler: twrnc can dynamically compile classes (eg Advantages of a build time compiler: Fast startup and component rendering (before-caching) Both libraries cache styles, so repeated renders should be fairly similar. For dynamic styles, twrnc uses a hook while NW uses an external store. In twrnc if the window resizes or color scheme changes the entire app will re-render, while NW will only render components that subscribed to those topics. This isn't super relevant for android/ios but is for web. Talking about web, NW has the ability to style RN components with CSS on web, while twrnc can only use I think both projects have a similar setup complexity, but TRNW is probably simpler to debug at runtime. Features:
twrnc exclusive features
NW exclusive features
As you can see both libraries achieve mostly the same thing, just in a different manner. NW has better web support, faster startup and some flashy extra features, but those might not be a priority for you. Also twrnc is much more mature and NativeWind is working on a stable release. The best thing about choosing either library is that both: -use Tailwind syntax
So it should be easy to migrate between either or try both at the same time! Hope that helps 👍 |
Beta Was this translation helpful? Give feedback.
-
Thanks for a great and useful comparison between this library How would they both compare to tailwind-rn (the currently most popular option)? I see from the readme of this library
But other than that, the differences, with their tradeoffs elude me... There's so many Tailwind for React Native options that my head is spinning...
Their relative popularity: Any knowledge on how to categorize and/or differentiate them would be greatly appreciated. Even if it would be shallow (since you probably don't have great insight into them), since your general domain knowledge here would go further than most. |
Beta Was this translation helpful? Give feedback.
-
Based on this benchmark, https://github.com/efstathiosntonas/react-native-style-libraries-benchmark Seems like twrnc is the fastest among the tailwind inspired styling libraries |
Beta Was this translation helpful? Give feedback.
-
@marklawlor Can I use clsx, tailwind-merge and class-variance-authority libs with nativewind 4.x? |
Beta Was this translation helpful? Give feedback.
-
How does this library compares to NativeWind ? https://github.com/marklawlor/nativewind
Beta Was this translation helpful? Give feedback.
All reactions