DEV Community

Cover image for NativeFlow: A Tailwind-Like, Object-Based React Native UI Library 🚀
Jay Singh
Jay Singh

Posted on

NativeFlow: A Tailwind-Like, Object-Based React Native UI Library 🚀

In the world of React Native development, UI styling can sometimes be a pain point, especially for those used to the flexibility and simplicity of utility-first CSS frameworks like Tailwind. You know the drill — hours spent wrestling with babel setups, styles, tweaking tiny details, and hoping it looks good on both iOS and Android. 🥲

Many existing solutions rely on wrapping Tailwind with custom Babel setups or trying to make it work inside React Native's ecosystem. But (let’s be real), these approaches often add extra complexity, unsupported properties, or completely miss out on platform-specific APIs.

That’s where NativeFlow comes in. 🦸‍♂️

What is NativeFlow?

NativeFlow is a React Native UI library with a syntax that closely resembles Tailwind but departs in one key way: it uses objects instead of classes. 🎉 This decision aligns with how React Native handles styling natively – because let's face it, RN prefers objects, unlike the web, where classes dominate.

So... Why does this matter? 🤔

Most Tailwind-inspired React Native libraries use a “wrap-and-parse” technique. They require a Babel setup, parse your styles, and inject them as objects. While this may work, it brings along its own set of baggage:

  • Unsupported Properties: Features like web animated properties aren’t natively supported in React Native, yet many libraries attempt to force them in, leading to unexpected bugs.
  • Platform-Specific Limitations: Libraries often forget about properties unique to Android (looking at you, elevation) or iOS (what happened to borderCurve?), leaving your app with inconsistent styling across devices.

NativeFlow's Key Advantage: It Just Works

NativeFlow leverages React Native's natural strengths by allowing styling directly as objects, ensuring every property it supports is fully compatible with React Native’s platform-specific APIs.

Monke do not like Babel

  • Zero Setup Hassles: There’s no need for additional Babel setups or complex configurations. NativeFlow works out-of-the-box.
  • Object-Based Syntax: The familiarity of object-based styling with the utility-first approach of Tailwind is preserved, making it intuitive for developers who are already accustomed to Tailwind.
  • True React Native Support: No funky hacks. Everything NativeFlow does is fully supported by React Native’s ecosystem. It’s native-born, no forced migrations.
  • Advanced Platform-Specific Properties: NativeFlow embraces platform-specific styling options, like elevation, shadow properties, and borderCurve, allowing developers to build platform-optimized user interfaces easily.
  • Fully Open Source: NativeFlow is 100% open-source, with well-organized docs. Contributions are welcome!

How Does NativeFlow Work? ⚙️

NativeFlow provides utility objects similar to Tailwind – the default styling format in React Native. This makes it faster, more reliable, and true to the framework's core.

Here’s a quick example of using NativeFlow:



import { View, Text } from "react-native";
import { flex, justify, text} from "nativeflowcss";

const App = () => {
  return (
    <View style={[flex.f_1, justify.center]}>
      <Text style={[text.center, text.fs_2xl, text.color_amber_600 ]}>
        Hello World
      </Text>
    </View>
  );
};

export default App;


Enter fullscreen mode Exit fullscreen mode

✨ See the resemblance to Tailwind? But wait... there’s more! NativeFlow is specifically designed to work flawlessly with React Native’s unique layout system.

Want to see it in action? A snippet on a Todo List (yeah canon event) built using React Native, styled using NativeFlow, check it out here - Expo Snack

Why NativeFlow should be Trending

With React Native’s rise as a go-to for cross-platform development, tools that simplify the process are in demand. NativeFlow’s object-based syntax and deep integration with native properties offer a perfect balance between simplicity and power. No extra setup, no missing features – just plug and play.

Benefits At A Glance:

  • Familiar Tailwind-Like Syntax: Reuse your Tailwind knowledge while building native mobile apps.
  • Seamless Native Support: NativeFlow fully supports both Android and iOS without additional workarounds.
  • Active, Open-Source Project: NativeFlow is community-driven, and developers are encouraged to collaborate.

Conclusion

If you're tired of dealing with configuration issues, unsupported properties, or just want to streamline your UI development, NativeFlow is the library you’ve been waiting for.

Try NativeFlow today, and experience the difference:

Goosebumps meme

Top comments (3)

Collapse
 
martinbaun profile image
Martin Baun

Personally, I use Franken, but this doesn't look too bad!! :)

Collapse
 
omoefebazunu profile image
Omoefe Bazunu

What about NativeWind??
I'm at lost.

Collapse
 
mathdebate09 profile image
Jay Singh

nativewind lacks support for platform specific properties and NativeFlow slacks 8%, whereas nativewind slacks 147%, 18x faster.