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

@molecule/app-theme-nativewind

v1.1.0

Published

NativeWind theme provider for molecule.dev: the web theme palette and light/dark mode on React Native

Readme

@molecule/app-theme-nativewind

NativeWind theme provider for molecule.dev: the web's theme palette and light/dark mode on React Native (iOS, Android and Expo web).

It implements @molecule/app-theme, so useTheme(), toggleMode() and theme switchers work as they do on the web. Every colour token of @molecule/app-ui-tailwind's base.css, the derived ones included (surface-container, on-primary, …), is computed from the active theme and set as one of NativeWind's root variables, so every mounted component repaints. dark: utilities follow the theme, not only the device setting.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

import { setProvider } from '@molecule/app-theme'
import {
  createNativeWindThemeProvider,
  darkTheme,
  lightTheme,
} from '@molecule/app-theme-nativewind'

export const themeProvider = createNativeWindThemeProvider({
  themes: [lightTheme, darkTheme],
  defaultTheme: 'light',
  systemDefault: true,
  persistKey: 'molecule-theme',
})
setProvider(themeProvider)

Type

provider

Installation

npm install @molecule/app-theme-nativewind @molecule/app-storage @molecule/app-theme @molecule/app-theme-css-variables @molecule/app-ui-tailwind nativewind react-native

API

Interfaces

NativeWindThemeStorage

Where a saved theme name is kept. Either call may be asynchronous: device storage is. @molecule/app-storage satisfies it.

interface NativeWindThemeStorage {
  /** Reads the saved theme name (`null` when there is none). */
  get(key: string): Promise<unknown> | unknown
  /** Saves the chosen theme name. */
  set(key: string, value: string): Promise<void> | void
}

NativeWindThemeConfig

Configuration for {@link createNativeWindThemeProvider}.

interface NativeWindThemeConfig {
  /** The themes the app offers. The first theme of each mode fills that mode until another is chosen. */
  themes: Theme[]
  /** The theme to start on (a name; default: the first theme). */
  defaultTheme?: string
  /**
   * With no saved choice, start on the theme whose mode matches the device's
   * appearance setting, and follow it when it changes, until the person picks a
   * theme. Default: false.
   */
  systemDefault?: boolean
  /** Saves the chosen theme under this key and restores it on the next launch. */
  persistKey?: string
  /**
   * Where `persistKey` is kept. Default: the `@molecule/app-storage` provider
   * bonded at startup (read once it is bonded, so the bond order does not matter).
   */
  storage?: NativeWindThemeStorage
}

NativeWindThemeProvider

A ThemeProvider for NativeWind, with a promise that settles once a saved theme has been read and applied.

interface NativeWindThemeProvider extends ThemeProvider {
  /** Settles once a saved theme (if any) has been restored: splash screens, tests. */
  ready: Promise<void>
}

Functions

createNativeWindThemeProvider(config)

Creates a theme provider for a NativeWind app (iOS, Android and Expo web).

Pair it with @molecule/app-ui-nativewind's Tailwind preset, which gives every colour class of the web ClassMap a variable this provider sets.

function createNativeWindThemeProvider(config: NativeWindThemeConfig): NativeWindThemeProvider
  • config — The themes, the starting theme, OS-following and persistence.

Returns: The provider.

Constants

lightTheme

The default light theme (the same palette as @molecule/app-theme-css-variables).

const lightTheme: Theme

darkTheme

The default dark theme (the same palette as @molecule/app-theme-css-variables).

const darkTheme: Theme

Core Interface

Implements @molecule/app-theme interface.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-storage ^1.1.1
  • @molecule/app-theme ^1.0.4
  • @molecule/app-theme-css-variables ^1.0.4
  • @molecule/app-ui-tailwind ^1.4.0
  • nativewind ^4.2.0
  • react-native >=0.72.0

Runtime Dependencies

  • @molecule/app-storage

  • @molecule/app-theme

  • @molecule/app-theme-css-variables

  • @molecule/app-ui-tailwind

  • nativewind

  • react-native

  • Needs the Tailwind preset from @molecule/app-ui-nativewind (presets: [require('nativewind/preset'), require('@molecule/app-ui-nativewind/preset')] in tailwind.config.js). It defines the colour classes as these variables and sets darkMode: 'class'. Without it, bg-primary has no rule and paints nothing.

  • systemDefault: true starts on the theme matching the device setting and follows it until the person picks a theme. Set "userInterfaceStyle": "automatic" in app.json, or iOS always reports light.

  • persistKey saves the chosen theme through the bonded @molecule/app-storage provider (or storage). Device storage is asynchronous, so the app starts on the default theme and switches once the saved one is read; await themeProvider.ready behind a splash screen to avoid the switch.

  • On Expo web the variables are set on <html> and .dark is toggled there.

  • React Navigation's headers and screen backgrounds are not ClassMap classes: pass useNavigationTheme(…) from @molecule/app-routing-react-navigation to <NavigationContainer theme={…}> so they follow this provider too.