npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rn-stylewind

v0.2.26

Published

A utility-first styling library for React Native with dynamic theming

Readme

React Native Stylewind

Ever wished you had the flexibility of utility-first styling in React Native, but with better maintainability, type-safety, and more developer freedom? Well, that's exactly what React Native Stylewind delivers! 🎉 With this library, you can enjoy dynamic style generation based on your custom theme, and still keep your styles clean, reusable, and highly maintainable.

Use utility styles for quick styling or leverage createStyle for more structured, theme-based styles. With full TypeScript support, you get the best of both worlds—ease of use and robust, type-safe development.

✨ Features

  • 🎨 Dynamic Theming – Utility styles are generated on the fly based on your theme.config.ts.
  • ⚡ Tailwind-Like Styling – Use familiar utility styles for a seamless styling experience.
  • 🛠️ Highly Customizable – Define your own colors, utilities, spacing, typography.
  • 🔐 Type-Safe – Full TypeScript support ensures your styles are always correct.
  • 🚀 Real-Time Updates – Styles regenerate automatically when your theme changes.
  • 🛆 Tree-Shaking for Performance – Unused styles get kicked out, keeping your bundle lean.
  • 💡 Flexible Usage – Use utility-first styles or createStyle with theme configurations.

👥 Installation

First, install the package via npm or yarn:

npm install rn-stylewind
# or
yarn add rn-stylewind

🛠️ Setup

Before diving in, wrap your Metro bundler config to enable dynamic style generation.

1️⃣ Add to metro.config.js

const { getDefaultConfig } = require('expo/metro-config');
const withRNStylewind = require('rn-stylewind/metro');

const defaultConfig = getDefaultConfig(__dirname);

module.exports = withRNStylewind(defaultConfig);

2️⃣ Initialize Default Theme Configuration

To initialize and create the default theme.config.mjs file, run the following command:

npx init-rn-stylewind

This will generate a theme.config.mjs file in the root directory of your project as below. You can customize this file to define your theme colors, spacing, typography, utilities.

// theme.config.mjs
import { createTheme } from 'rn-stylewind';

export default await createTheme({
  mode:'light',
  colors: {
    primary: {
      default: '#1D4ED8',
      light: '#93C5FD',
      dark: '#1E3A8A',
    },
  },
  spacing: {
    default: 8,
  },
  // Modify other theme settings if needed
});

🎯 Usage

Wrap your application with ThemeProvider to ensure your styles and theme configurations are accessible throughout the project:

import { ThemeProvider } from 'rn-stylewind';
import MyComponent from './MyComponent';

function App() {
  return (
    <ThemeProvider>
      <MyComponent />
    </ThemeProvider>
  );
}

Here’s how simple and powerful stylewind is:

import { Text, Pressable } from 'react-native';
import {  styles } from 'rn-stylewind';

// 🚀 Utility-first styling at its finest!
export const Button = ({ title, ...rest }) => {
  return (
    <Pressable style={styles(['bgError', 'p-5'])} {...rest}>
      <Text style={styles(['textWhite', 'text-lg'])}>{title}</Text>
    </Pressable>
  );
};

Using styles Function

The styles function allows developers to apply utility styles easily. If a color-based utility class does not specify a Dark or Light mode variant, styles will automatically pick the appropriate color based on the current theme mode.

<View style={styles(['bgPrimary'])}> // if mode is `light`, `bgPrimary` will return `bgPrimaryLight` color
  <Text style={styles(['textBase'])}>Dynamic Themed Text</Text> 
</View>

Using createStyle

The createStyle function enables structured, reusable styles with full TypeScript support and theme-based values.

import { createStyle, styles } from 'rn-stylewind';

const useMyStyles = createStyle({
  container: (theme) => ({
    padding: theme.spacing.md,
    backgroundColor: theme.utilities.bgBackground.backgroundColor,
    ...theme.utilities['p-1'] // using utility style
  }),
  text: {
    padding: 4
  },
});

function MyComponent() {
  const myStyles = useMyStyles();
  return (
    <View style={styles([myStyles.container])}>
      <Text style={styles([myStyles.text])}>Hello, world!</Text>
    </View>
  );
}

Using useTheme Hook

To access the theme context, use the useTheme hook:

import { useTheme,styles } from 'rn-stylewind';

export const MyComponent = () => {
  const { theme, isDarkMode, toggleMode } = useTheme();
  
  return (
    <View style={styles([isDarkMode ? 'bgBlack' : 'bgWhite'])}>
      <Text style={styles(['textPrimary'])}>Current Theme: {theme.mode}</Text>
      <Button title="Toggle Theme" onPress={toggleMode} />
    </View>
  );
}

Now, you can use useTheme() in your components to access the theme and utilities dynamically.

📚 Documentation

For full documentation, visit React Native Stylewind.

Platform Support

supports Expo supports iOS supports Android supports web

React Native Stylewind is 100% compatible with the Expo Framework and works with both Expo Go and in the bare workflow.

🔥 Why You'll Love It

No more inline styles cluttering your components
Faster development with utility-driven styling
Built for performance with tree-shaking
Theming that just makes sense
Flexibility to use utility styles or structured styles

Now go forth and style like a boss! 🚀