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

styledwind-native

v1.1.3

Published

A lightweight utility for applying dynamic Tailwind CSS styles in React Native

Downloads

8

Readme

styledwind-native

styledwind-native

A tiny wrapper for twrnc that brings a familiar styled-components-like API to React Native, making it easy to apply dynamic Tailwind CSS styles while avoiding verbose inline styling.

Description

styledwind-native is a lightweight utility designed to offer a familiar styled-components API on top of twrnc for React Native. It allows you to apply Tailwind utility classes in a clean, declarative manner, making your components more maintainable by avoiding excessive inline styles.

With styledwind-native, you can:

  • Define React Native components with Tailwind utility classes using a concise API.
  • Dynamically adjust styles based on component props.
  • Seamlessly handle safe-area insets for modern devices.
  • Keep your components cleaner and easier to maintain, while still leveraging the full power of Tailwind CSS and twrnc.

Features

  • Familiar API: Styled-components-like API, so you can define your styles and components without verbose inline styles.
  • Tailwind CSS for React Native: Leverages the power of twrnc to bring utility-first styling to your components.
  • Dynamic Styling with Props: Conditionally apply styles based on props, making your components more flexible and reusable.
  • Support for Core React Native Components: Easily style components like View, Text, ScrollView, and many more.
  • Safe-Area Insets Support: Automatically adjust layouts for safe-area insets to handle notches and system bars on modern devices.
  • Fully Configurable: Works seamlessly with your own Tailwind configuration via tailwind.config.js.

Installation

To install styledwind-native along with twrnc, run:

npm install styledwind-native twrnc

Usage Example

Here's how you can use styledwind-native to create dynamically styled components:

import React from 'react';
import tw from 'styledwind-native';

const Text = tw.Text<{ isBig?: boolean }>`
  text-base

  ${props => props.isBig && tw`text-2xl`}
`;

const MyComponent = () => {
  return (
    <Text isBig>
      This text is styled with Tailwind!
    </Text>
  );
};

export default MyComponent;

Provider Setup

To enable color scheme management, wrap your app with the Provider component:

import React from 'react';
import { Provider } from 'styledwind-native';
import AsyncStorage from '@react-native-async-storage/async-storage';

export default function App() {
  return (
    <Provider
      initialColorScheme="device" // 'light' | 'dark' | 'device'
      storage={AsyncStorage} // Optional: for persistent storage
    >
      {/* Your app content */}
    </Provider>
  );
}

Color Scheme Management

styledwind-native provides built-in support for light/dark mode with automatic system detection.

Using the useColorScheme Hook

import { useColorScheme } from 'styledwind-native';

function SettingsScreen() {
  const {
    colorScheme,        // Current color scheme being used ('light' | 'dark')
    internalColorScheme, // User's preference ('light' | 'dark' | 'device')
    setColorScheme,     // Function to change color scheme
    toggleColorScheme   // Function to toggle between light/dark
  } = useColorScheme();

  return (
    <View>
      <Text>Current theme: {colorScheme}</Text>
      <Text>User preference: {internalColorScheme}</Text>

      <Button
        title="Light Mode"
        onPress={() => setColorScheme('light')}
      />
      <Button
        title="Dark Mode"
        onPress={() => setColorScheme('dark')}
      />
      <Button
        title="System Mode"
        onPress={() => setColorScheme('device')}
      />
      <Button
        title="Toggle Theme"
        onPress={toggleColorScheme}
      />
    </View>
  );
}

Color Scheme Options

  • 'light': Force light mode
  • 'dark': Force dark mode
  • 'device': Automatically follow the system's color scheme

Using Dark Mode Classes

Style your components with Tailwind's dark mode utilities:

const Card = tw.View`
  bg-white
  dark:bg-gray-800
  border-gray-200
  dark:border-gray-700
  p-4
  rounded-lg
`;

const Text = tw.Text`
  text-gray-900
  dark:text-white
`;

When set to 'device' mode, the library automatically detects system color scheme changes and updates all styled components accordingly.

VS Code Intellisense

Add the following to the settings of the official Tailwind plugin for VS Code.

// ...
"editor.quickSuggestions": {
  "strings": true // forces VS Code to trigger completions when editing "string" content
},
"tailwindCSS.classAttributes": [
  // ...
  "style"
],
"tailwindCSS.includeLanguages": {
  "typescript": "javascript", // if you are using typescript
  "typescriptreact": "javascript"  // if you are using typescript with react
},
"tailwindCSS.experimental.classRegex": [
  "tw`([^`]*)", // tw`...`
  "tw\\.[^`]+`([^`]*)`" // tw.xxx<xxx>`...`
],

More detailed instructions, including how to add snippets, are available here.

Why Use styledwind-native?

If you're building a React Native app and want to use Tailwind CSS for styling, styledwind-native simplifies the process by wrapping twrnc with a styled-components-like API. This reduces the need for verbose inline styles, making your components cleaner, easier to read, and more maintainable.