/expo-stack:expo-stack-stylingfrom expo-stack
Decides when to use Uniwind (Tailwind v4), StyleSheet, or native React Native style props. Covers setup pitfalls, className on third-party components, and theme integration for Expo apps.
Ships in expo-stack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Defer to uni-stack/uniwind for the full Uniwind API and to code-with-beto/skills → theming for the native-color theme system. This skill is the decision layer: which tool for which job, and the traps.
| Use | For |
|---|---|
Uniwind className | Everything static. This is the default and should cover ~95% of styling. |
StyleSheet / inline style | Values that cannot be expressed as a class name: animation interpolations, colors from an API, computed dimensions. |
Do not mix the two for the same property on the same element. Pick one per property, or the specificity rules below will surprise you.
// metro.config.js
const { getDefaultConfig } = require('expo/metro-config')
const { withUniwindConfig } = require('uniwind/metro')
const config = getDefaultConfig(__dirname)
module.exports = withUniwindConfig(config, {
cssEntryFile: './src/global.css',
dtsFile: './src/uniwind-types.d.ts',
})
/* src/global.css */
@import 'tailwindcss';
@import 'uniwind';
Four things that go wrong here:
withUniwindConfig must be the outermost wrapper. Any other with*Config goes inside it.cssEntryFile must be a relative string — './src/global.css'. Not path.resolve(...), not absolute.@source for each extra directory — see expo-stack-architecture for the monorepo case.global.css from src/app/_layout.tsx, never from the root entry file. Importing it where the root component is registered turns every CSS edit into a full reload instead of a hot reload.uniwind-types.d.ts is generated from the CSS entry, so TypeScript shows errors until it exists. Starting Metro is not always enough — it emits on the CSS transform, so a bundler that has not yet served a bundle may not have produced it. The reliable way, and what CI should run before tsc or a Tailwind linter:
npx uniwind generate-artifacts --css ./src/global.css --dts ./src/uniwind-types.d.ts
className on third-party componentsUniwind only adds className to React Native's built-ins. Any other component — pressto's pressables, SafeAreaView from safe-area-context, Animated.View, anything from a UI library — has no className prop at all, and TypeScript rejects it.
Wrap once, in one place, and import from there:
// src/components/pressable.tsx
import { PressableScale } from 'pressto'
import { withUniwind } from 'uniwind'
export const Press = withUniwind(PressableScale)
For components whose styling goes through a differently-named prop, map it:
const StyledProgress = withUniwind(ProgressBar, {
width: { fromClassName: 'widthClassName', styleProperty: 'width' },
})
<StyledProgress widthClassName="w-64" progress={0.5} />
When wrapping is impractical (a prop that takes a resolved style object, navigation screenOptions), use useResolveClassNames('bg-white dark:bg-gray-900') to turn classes into a style object.
Theme-varying colours go in @variant blocks, not @theme. @theme is for tokens that do not change with the theme (spacing, radii); @theme static additionally keeps a token available to useCSSVariable even when no className references it.
@layer theme {
:root {
@variant light { --color-bg: #ffffff; --color-fg: #0a0a0a; }
@variant dark { --color-bg: #0a0a0a; --color-fg: #fafafa; }
}
}
Define exactly the same variables in every theme. Miss one and Uniwind refuses to generate artifacts with All themes must have the same variables — which is a good error, but only if you know it means "add the variable to the other theme", not "the CSS is malformed".
Reference a variable by its name minus the --color- prefix: --color-bg → bg-bg / text-bg.
Uniwind supports Tailwind v4 only. A v3-style tailwind.config.js is not read.
<View className="bg-red-500 bg-blue-500" /> // undefined winner — Uniwind does NOT dedupe
<View className="bg-blue-500 bg-red-500!" /> // red — `!` raises priority
<View className="bg-red-500!" style={{ backgroundColor: 'blue' }} /> // BLUE
Inline style always beats className, even !. In shared components where a consumer passes className, run the merge through tailwind-merge so overrides behave predictably:
import { twMerge } from 'tailwind-merge'
export function Card({ className, ...rest }: ViewProps) {
return <View className={twMerge('rounded-xl bg-white p-4 dark:bg-neutral-900', className)} {...rest} />
}
Tailwind parses class names at build time, so anything constructed at runtime produces no styles:
<Text className={`text-${color}`} /> // ✗ nothing
<View className="bg-{{ error ? 'red' : 'green' }}-600" /> // ✗ nothing
Write complete names:
<View className={error ? 'bg-red-600' : 'bg-green-600'} /> // ✓
const variants = { // ✓ for prop-driven styling
primary: 'bg-blue-500 text-white',
danger: 'bg-red-500 text-white',
}
<Text className={variants[props.tone]} />
For anything with multiple axes, use tailwind-variants (tv) — Uniwind supports it, and compound variants beat hand-rolled conditionals.
The highest-value section in this skill. These properties exist in modern React Native and AI-generated code consistently misses all of them, reaching for a library or the deprecated API instead. MDN is the reference for their behaviour; they follow web CSS.
| Instead of | Use | Notes |
|---|---|---|
shadowColor + shadowOffset + shadowOpacity + shadowRadius + elevation | boxShadow: '0 4px 12px rgba(0,0,0,0.15)' | One string, identical on iOS and Android. Multi-layer shadows supported (comma-separated). The old five-prop API is the single most common stale pattern in generated RN code. |
margin/marginRight spacing hacks between children | gap, rowGap, columnGap | |
expo-linear-gradient for a simple gradient | backgroundImage: 'linear-gradient(...)' (experimental) | Full web syntax including colour stops and percentages. Keep the library for gradients that must animate or mask. |
| a blur/effects library | filter: 'blur(8px)', invert, brightness, saturate | Android supports the full set; iOS currently only brightness and opacity. For iOS blur you still need expo-blur. |
| compositing hacks | mixBlendMode | multiply, screen, overlay, darken, difference, … Needs something behind it to blend with. |
When reviewing code, treat the five-prop shadow API as a defect, not a style preference.
CSS-first — no ThemeProvider needed for colours. Uniwind pre-registers light, dark and system:
/* src/global.css */
@theme {
--color-bg: #ffffff;
--color-fg: #0a0a0a;
--color-brand: #4f46e5;
}
@layer theme {
:root {
@variant dark {
--color-bg: #0a0a0a;
--color-fg: #fafafa;
}
}
}
<View className="bg-bg dark:bg-bg">
<Text className="text-fg">…</Text>
</View>
Switching at runtime:
import { Uniwind, useUniwind } from 'uniwind'
Uniwind.setTheme('dark') // also calls Appearance.setColorScheme, so Alert/Modal match
Uniwind.setTheme('system') // re-enables following the device
const { theme, hasAdaptiveThemes } = useUniwind()
Note the asymmetry: setting light/dark disables adaptive themes until you set system again. A three-way switcher must render system as the active option when hasAdaptiveThemes is true, not the resolved theme.
Extra themes beyond light/dark need declaring in both places — extraThemes: ['ocean'] in metro.config.js and @variant ocean { … } in CSS — then a Metro restart.
For screens that should feel like the OS rather than like your brand, use the platform palette instead of tokens: Colors.ios.systemBackground, Colors.android.dynamic.surfaceContainer. Dark mode is automatic, and on Android the palette follows the user's wallpaper (Material You). This is most of what makes a settings screen feel native rather than themed.
Use tokens for brand surfaces, platform colours for system surfaces. code-with-beto/skills → theming scaffolds a useColors() hook that unifies both behind semantic names; prefer that over scattering Colors.ios.* through components.
One implementation detail worth knowing if you write your own: platform colours are opaque objects React cannot diff, so a resolver must take the colour scheme as an argument even if it never reads it — that is what makes a light/dark toggle actually re-render.
Set debug: true in withUniwindConfig while developing to get errors for web-only CSS that React Native cannot apply (Unsupported value type - "filters" for className headerBlur). Turn it off for production builds.
After any Metro-config or theme change: npx expo start --clear.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub flyingwebie/skills --plugin expo-stack14 skills in this plugin
/expo-stackScaffold, configure, diagnose, polish, and ship production Expo applications with the Expo Stack workflow in Codex./expo-stack-architectureFolder layout, the routes-only rule, platform file extensions, and monorepo/workspace wiring for an Expo Router app in this stack. Use when scaffolding a project, deciding where a new file belongs, adding a shared package, or fixing Metro resolution in a bun/pnpm/yarn workspace./expo-stack-asoApp Store Optimization as part of the build loop — the indexed metadata fields, keyword strategy, screenshots that rank as well as convert, review-prompt timing, and store localization matched to the app's locales. Use when preparing a store listing, choosing a title/subtitle/keywords, planning screenshots, adding a rating prompt, or asked why an app is not being found./expo-stack-data-authWiring Convex and Better Auth into an Expo Router app — cloud or self-hosted Convex, the expo/convex client plugins, route guards, and env-var discipline. Use when setting up or debugging auth, adding a Convex function or schema, choosing between cloud and self-hosted, or when sessions, cookies, redirects or convex env vars misbehave./expo-stack-deep-linkingDeep linking in this stack — app scheme, Universal Links / App Links, the `+native-intent.tsx` rewrite hook, and deferred deep linking that survives an App Store install. Use when adding share/invite links, handling an OAuth or magic-link callback, wiring referrals or attribution, or debugging a link that opens the wrong screen, opens the store instead of the app, or gets swallowed by an auth or onboarding gate./expo-stack-i18nMulti-language support with react-i18next, i18next and expo-localization in an Expo Router app — typed locale files, device-language detection, a persisted user override, and RTL. Use when adding localisation, adding a language, changing how strings are organised, or when translations resolve to their key instead of text.Other plugins' skills for the same job