Why is Unistyles Goated
8 min read
Why Unistyles is the React Native styling library I’d pick: no re‑renders from style changes, centralized theming and native level performance.
When your Flutter engineers get pulled onto other projects without warning, and nobody left on your TypeScript-focused team can maintain the codebase, migrating to React Native becomes inevitable.

The Problem
As the project lead for this migration, I had to plan the architecture and tech stack, and for styling I was stuck choosing between a few equally disappointing options:
-
NativeWind promised familiar Tailwind syntax but came with weird behaviors and performance caveats that weren’t worth the hassle. I also don’t get the trend of using the exact same tools on platforms that are fundamentally different. When you pick a tool, how well it works and how easy it is to use should come first. Skipping that because something feels familiar just gives you a false sense of security in your choice.
-
Dripsy: kinda mid, ngl.
-
Regular React Native StyleSheet felt like writing CSS in 2010: repetitive and completely disconnected from modern workflows. Modern interactive apps also have a lot of complex conditional styling, so if you go with it anyway, be ready for the re-renders you’ll get on every interaction just to change a style.
The Discovery
So I started asking experienced friends what they would use. Then one of them told me:
If we are going to build a new app this won’t be a problem and I would be using Unistyles
I was like, “What is this Unistyles?”
So I read the docs. Put simply, it’s a drop-in replacement for the regular React Native StyleSheet, but on steroids. TRUST ME, I’m not exaggerating.
Unistyles prides itself on being lightweight, fast and easy to use. As their docs put it, “Unistyles is a superset of StyleSheet similar to how TypeScript is a superset of JavaScript”. Nothing new, except the superpowers it gives you.
What Makes Unistyles Special
Unistyles is built with C++ and runs on nitro modules.
What are Nitro Modules? Nitro modules are React Native’s next gen native module system, built to replace the old bridge. The bridge had to serialize everything passed between JavaScript and native code, which was expensive. Nitro modules talk to native code directly and synchronously through the JSI, so there’s no serialization overhead, native calls are type safe, and performance is nearly the same as pure native code.
So it’s fast out of the gate, close to natively styled apps.
Performance wasn’t the only thing. Once we started integrating Unistyles into the migration, I found features that changed how we style things in React Native.
Here are the features I love most, with examples of how to set them up and use them:
No Extra Re-renders
With the regular React Native StyleSheet, you have to put inline logic in the style prop to style components conditionally. That makes your code extremely ugly, hard to maintain and full of spaghetti, and every theme or screen size change means a re-render just to recompute those styles.
Unistyles lets you write dynamic style functions instead. You pass in whatever props your logic needs and your code stays clean.
Local state like isPressed still re-renders the component (that’s just React), but theme, breakpoint and runtime changes won’t cause a re-render.
Every component calls useContext(ThemeContext) for its colours.
Colours come from CSS variables; no component reads the theme.
Real render counts in your browser. Unistyles does the theme swap on the native side; CSS variables are the web equivalent.
Theme in contextEvery consumer re-renders.
Unistyles0 re-renders, styles update natively.
Now imagine the same thing in a real app, where the React tree has tens of components and hundreds of nodes. With the theme in context, every one of them re-renders on a theme change. With Unistyles, none of them do.
Here’s the difference:
Regular StyleSheet (inline logic):
import { useState } from "react";
import { View, TouchableOpacity, Text, StyleSheet } from "react-native";
export const ButtonComponent = () => {
const [isPressed, setIsPressed] = useState(false);
const [isDisabled, setIsDisabled] = useState(false);
return (
<TouchableOpacity
style={[
styles.button,
// This inline logic runs on every render, and the
// whole thing can easily grow into spaghetti code with
// increasing complexity.
isPressed && styles.pressed,
isDisabled && styles.disabled,
]}
onPressIn={() => setIsPressed(true)}
onPressOut={() => setIsPressed(false)}
>
<Text style={[styles.text, isDisabled && styles.disabledText]}>
Button
</Text>
</TouchableOpacity>
);
};
const styles = StyleSheet.create({
button: {
padding: 16,
backgroundColor: "#007AFF",
borderRadius: 8,
},
pressed: {
backgroundColor: "#0056CC",
transform: [{ scale: 0.98 }],
},
disabled: {
backgroundColor: "#CCCCCC",
},
text: {
color: "white",
fontWeight: "bold",
},
disabledText: {
color: "#666666",
},
});Unistyles (no inline logic, no spaghetti):
import { useState } from "react";
import { View, TouchableOpacity, Text } from "react-native";
import { StyleSheet } from "react-native-unistyles";
export const ButtonComponent = () => {
const [isPressed, setIsPressed] = useState(false);
const [isDisabled, setIsDisabled] = useState(false);
return (
<TouchableOpacity
// No inline logic, and no re-renders from theme changes!
style={styles.button(isPressed, isDisabled)}
onPressIn={() => setIsPressed(true)}
onPressOut={() => setIsPressed(false)}
>
{/* Easy, clean and maintainable. */}
<Text style={styles.text(isDisabled)}>Button</Text>
</TouchableOpacity>
);
};
const styles = StyleSheet.create({
// In each dynamic style function you can easily pass each
// prop needed, and whats amazing is that when the theme or
// breakpoint changes, no re-renders will happen.
button: (isPressed: boolean, isDisabled: boolean) => ({
padding: 16,
backgroundColor: isDisabled ? "gray" : isPressed ? "green" : "blue",
borderRadius: 8,
transform: isPressed ? [{ scale: 0.98 }] : undefined,
}),
text: (isDisabled: boolean) => ({
color: isDisabled ? "#666666" : "white",
fontWeight: "bold",
}),
});It all happens in the dynamic style functions: when the theme, breakpoint or other runtime values change, Unistyles updates the styles at the native level, without any React re-renders.
Customizability, Theming and Consistent Styling
Unistyles’ theming gets rid of hardcoded values and makes your app easy to customize. Instead of scattering magic numbers and
hex codes through your styles, you define everything once in a theme object and read it with theme.[property]. When you need to
change the theme, you change the theme object without worrying about whether the styles still apply correctly.
The theme object holds your whole design system in one place: sizing, spacing, colors, typography and more.
We set it up with Tailwind-style key-value conventions, which gives designers and developers a shared vocabulary. A designer specifies
width: 64 in their design tool, and a developer writes width: theme.sizing["64"] (64 × 4 = 256px in Tailwind’s convention),
so the result stays pixel perfect.
Here’s how theming works:
1. Define your theme object in Unistyles.ts:
// unistyles.ts
import { StyleSheet } from "react-native-unistyles";
const baseTheme = {
// Tailwind style sizing for width, height, etc. (n × 4 px)
sizing: {
"0": 0,
px: 1,
"1": 4,
"2": 8,
"4": 16,
"16": 64,
"48": 192,
"64": 256,
"112": 448,
// …
},
// Tailwind style spacing for padding, margin, etc.
spacing: {
"0": 0,
"1": 4,
"2": 8,
"4": 16,
"6": 24,Show all 120 linesShow fewer lines
"8": 32,
// …
},
// Tailwind style border radius
borderRadius: {
sm: 8,
md: 12,
lg: 16,
full: 9999,
// …
},
typography: {
fontSize: {
sm: 14,
base: 16,
lg: 18,
"2xl": 24,
// …
},
fontWeight: {
base: "400",
medium: "500",
bold: "700",
// …
},
},
// Helper functions for intermediate values within the theme
utils: {
// Function to create consistent elevation shadows
createElevationShadow: (elevation: number) => ({
shadowOffset: { width: 0, height: elevation * 0.5 },
shadowOpacity: elevation * 0.05,
shadowRadius: elevation * 1.2,
elevation, // Android
}),
// Function for consistent spacing scales
getScaledSpacing: (baseValue: number, scale: number) => baseValue * scale,
},
};
const lightTheme = {
...baseTheme,
colors: {
primary: "#007AFF",
background: "#FFFFFF",
card: "#FFFFFF",
text: "#000000",
textSecondary: "#8E8E93",
// …
},
} as const;
const darkTheme = {
...baseTheme,
colors: {
primary: "#0A84FF",
background: "#000000",
card: "#2C2C2E",
text: "#FFFFFF",
textSecondary: "#8E8E93",
// …
},
} as const;
// you can also add as many themes as you need to
const themes = {
light: lightTheme,
dark: darkTheme,
};
// Custom width breakpoints, just like the web, for phones, tablets and anything bigger.
const breakpoints = {
xs: 0,
sm: 576,
md: 768,
lg: 992,
xl: 1200,
} as const;
// you can easily get the types to create components
// with variants just like shadcn/ui
type AppBreakpoints = typeof breakpoints;
type AppThemes = typeof themes;
declare module "react-native-unistyles" {
interface UnistylesThemes extends AppThemes {}
interface UnistylesBreakpoints extends AppBreakpoints {}
}
StyleSheet.configure({
settings: {
initialTheme: "light",
},
breakpoints,
themes,
});2. Use theme.[anything] in your styles:
import { StyleSheet } from "react-native-unistyles";
const styles = StyleSheet.create((theme) => ({
// Easily access any color from your theme
container: {
backgroundColor: theme.colors.background,
paddingVertical: theme.spacing["4"], // 16px padding vertical
borderRadius: theme.borderRadius.sm, // 8px border radius
width: {
xs: theme.sizing["64"], // 256px width on mobile
md: theme.sizing["112"], // 448px width on tablet screens
},
},
title: {
color: theme.colors.text,
fontSize: theme.typography.fontSize["2xl"], // 24px
fontWeight: theme.typography.fontWeight.bold,
marginBottom: theme.spacing["6"],
},
button: {
backgroundColor: theme.colors.primary,
paddingHorizontal: theme.spacing["8"],
borderRadius: theme.borderRadius.md,
width: theme.sizing["48"],
},
// Using theme utility functions for intermediate values
card: {
backgroundColor: theme.colors.card,
borderRadius: theme.borderRadius.md,
padding: theme.spacing["4"],
// Use theme utils for consistent elevation shadows
...theme.utils.createElevationShadow(4),
},
scaledContainer: (scale: number) => ({
// Use theme utils to maintain spacing consistency
padding: theme.utils.getScaledSpacing(theme.spacing["4"], scale),
margin: theme.utils.getScaledSpacing(theme.spacing["2"], scale),
}),
}));Design and developer handoff made simple
This pays off when your design team uses the same numeric system. When a designer says “make the button width 64 and add spacing of 8”, you can translate that directly to:
button: {
width: theme.sizing["64"], // Designer says "width 64" → 256px
padding: theme.spacing["8"], // Designer says "spacing 8" → 32px
}theme.[anything] gives you access to any property you’ve defined in your theme object. Want a new color?
Add it to theme.colors and use it anywhere as theme.colors.newColor. Need different shadows? Define
theme.shadows and use theme.shadows.[shadowName].
Your whole design system ends up centralized, consistent and easy to change. For intermediate values or calculations,
you can put utility functions right in the theme object (like theme.utils.createElevationShadow(4)) so those stay
consistent and maintainable too. Told you, I’m not exaggerating.
Toggling themes made easy
Toggling themes takes one call: pass the theme name as a string to UnistylesRuntime.setTheme.
import { Pressable, Text } from "react-native";
import { UnistylesRuntime } from "react-native-unistyles";
// change the theme in any component
export const ChangeTheme = () => {
// get the current theme
const handleThemeChange = () => {
const currentTheme = UnistylesRuntime.themeName;
UnistylesRuntime.setTheme(currentTheme === "light" ? "dark" : "light");
};
// toggle the theme
return (
<Pressable onPress={handleThemeChange}>
<Text>Change theme</Text>
</Pressable>
);
};This switches between the light and dark themes. You can also pass a callback that runs after the theme changes.
Everywhere Usage
Whether or not you use server rendering, you can reach Unistyles from anywhere in your app to get themes, variables, breakpoints and so on.
If you do need the theme object inside a component, use the useUnistyles hook.
import { useUnistyles } from "react-native-unistyles";
export const ThemeComponent = () => {
const { theme } = useUnistyles();
return <View style={{ backgroundColor: theme.colors.background }} />;
};To server-side render with Next.js, wrap your app in a client component that injects Unistyles’ styles
with useServerUnistyles and Next’s useServerInsertedHTML:
"use client";
import { PropsWithChildren, useRef } from "react";
import { useServerUnistyles } from "react-native-unistyles/server";
import { useServerInsertedHTML } from "next/navigation";
import "./unistyles";
export const Style = ({ children }: PropsWithChildren) => {
const isServerInserted = useRef(false);
const unistyles = useServerUnistyles();
useServerInsertedHTML(() => {
if (isServerInserted.current) {
return null;
}
isServerInserted.current = true;
return unistyles;
});
return <>{children}</>;
};Then wrap your app in the Style component.
import "../unistyles";
import { Style } from "../Style";
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body>
<Style>{children}</Style>
</body>
</html>
);
}Now you can style client or server, web or native, the same way.
Beyond Styling
Most devs reach for react-native-safe-area-context or similar libraries just to get basic device measurements.
Unistyles gives you all of it through UnistylesRuntime, with no extra dependencies.
import { UnistylesRuntime } from "react-native-unistyles";
// Screen dimensions - always current, always accurate
UnistylesRuntime.screen.width; // 400
UnistylesRuntime.screen.height; // 760
// Safe area insets - no more useSafeAreaInsets hook
UnistylesRuntime.insets.top; // 42
UnistylesRuntime.insets.bottom; // 24
// Status/navigation bars - for custom headers/footers
UnistylesRuntime.statusBar.height; // 24
UnistylesRuntime.navigationBar.height; // 24
// Device specs
UnistylesRuntime.pixelRatio; // 2.0
UnistylesRuntime.fontScale; // 1.0These values update automatically when the orientation changes or when you show or hide system bars in code. No subscriptions, no effect hooks, no manual tracking: you read the values when you need them.
It’s one less dependency to worry about and one less thing that can break.
Conclusion
We started with a frustrating migration from Flutter to React Native and styling options that all felt like compromises. NativeWind had its quirks, regular StyleSheet felt ancient, and everything seemed to cause unnecessary re-renders. Then Unistyles came along and actually solved those problems.
Theme and breakpoint changes that don’t cause re-renders? Check. Centralized theming that actually makes sense? Check. Being able to toggle between light and dark modes without breaking a sweat? Check. Getting device measurements without importing yet another library? Check.
And all this flexibility comes with incredible performance. It’s built with C++ and uses nitro modules, so you get native-level speed with way more power than regular StyleSheet or any other alternative gives you. If you want to see how it all works, read how Unistyles works under the hood.
It cuts re-renders, centralizes your design system, works everywhere and is faster than the alternatives, and your code stays clean and actually enjoyable to write.
That’s why Unistyles is goated.