@molecule/app-ui-nativewind
Provider bond · ui · App (browser) · v1.7.0 · Apache-2.0
NativeWind UIClassMap bond for React Native
npm install @molecule/app-ui-nativewindnpm · Source on GitHub · Implements @molecule/app-ui
How it works
@molecule/app-ui-nativewind is a provider bond on the app (browser) side: it implements the ui core interface (@molecule/app-ui) with a concrete vendor or library behind it.
Your code calls the core; you wire this provider once at startup. Swapping vendors later is one line in that wiring, not a rewrite.
import { setClassMap } from '@molecule/app-ui'
import { classMap } from '@molecule/app-ui-nativewind'
setClassMap(classMap) // once, at app startupWorks with: @molecule/app-ui-tailwind
Reference
NativeWind UIClassMap bond for React Native, and the Tailwind preset that gives its classes the web's values on iOS, Android and Expo web.
The ClassMap is the web ClassMap (@molecule/app-ui-tailwind) with every class a device cannot
apply rewritten: sibling spacing (space-y-*) becomes gap-y-*; group/peer, pseudo-element,
arbitrary-selector and divider classes are dropped; a border with no colour gets the text colour
the web draws it in. The preset (@molecule/app-ui-nativewind/preset) defines what the ClassMap
names: every theme colour as a CSS variable the theme bond (@molecule/app-theme-nativewind)
sets, the font roles, the animations and Tailwind 4's radius, shadow and blur scales.
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.tsJSDoc, not this file.
Quick Start
import { setClassMap } from '@molecule/app-ui'
import { classMap } from '@molecule/app-ui-nativewind'
setClassMap(classMap) // once, at app startup
// tailwind.config.js
const molecule = require('@molecule/app-ui-nativewind/preset')
module.exports = {
content: ['./src/**/*.{ts,tsx}', ...molecule.moleculeContent(__dirname)],
presets: [require('nativewind/preset'), molecule],
}
Type
provider
Installation
npm install @molecule/app-ui-nativewind @molecule/app-ui-tailwind react
npm install -D @types/react
API
Constants
classMap
NativeWind UIClassMap — Tailwind classmap with RN-compatible overrides.
Wire at app startup:
import { setClassMap } from '@molecule/app-ui'
import { classMap } from '@molecule/app-ui-nativewind'
setClassMap(classMap)
const classMap: UIClassMap
Core Interface
Implements @molecule/app-ui interface.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-styling^1.0.1 (optional)@molecule/app-ui^1.7.0 (optional)@molecule/app-ui-tailwind^1.0.1nativewind^4.2.0 (optional)react^18.0.0 || ^19.0.0react-native-svg^15.11.2 (optional)tailwindcss^3.4.0 (optional)
Runtime Dependencies
-
@molecule/app-styling(optional) -
@molecule/app-ui(optional) -
@molecule/app-ui-tailwind -
nativewind(optional) -
react -
react-native-svg(optional) -
tailwindcss(optional) -
Without the preset in
tailwind.config.js, no theme colour class (bg-surface,text-foreground, …) generates a style: the screen renders with no colours. -
moleculeContent(__dirname)returns the ClassMap packages'distfolders wherever npm installed them. Literal./node_modules/@molecule/...globs match nothing once npm hoists the packages (any workspace). -
Pass
inlineRem: 16towithNativeWindinmetro.config.jssoremsizes match the web (NativeWind's default is 14). -
This package emits class strings: the app configures NativeWind v4 itself (Babel preset,
metro.config.js,tailwind.config.js).nativewindis not a dependency of this package. -
No CSS grid (
grid()approximates it with flex-wrap), nohover:(touch usesactive:), nobackdrop-blur, noposition: fixed, no portals (RNModalhandles overlays), noprose. Animations run on Reanimated. Don't hand-write utilities in app code: go throughgetClassMap().