react-native-unistyles…
Guide for using react-native-unistyles v3. Triggers on: "unistyles", "StyleSheet.create", "create stylesheet", "add theme",…
Migrate react-native-unistyles from v2 to v3. Triggers on: "migrate unistyles", "upgrade unistyles", "v2 to v3", "unistyles migration", "update unistyles", "convert unistyles v2". Covers all API changes including StyleSheet.create, useStyles removal, theme configuration,
Claude Code
$ npx -y skills add jpudysz/react-native-unistyles --skill unistyles-v2-to-v3-migration --agent claude-code
Codex
$ npx skills add jpudysz/react-native-unistyles --skill unistyles-v2-to-v3-migration -a codex -y
Cursor
$ npx skills add jpudysz/react-native-unistyles --skill unistyles-v2-to-v3-migration -a cursor -y
Gemini CLI
$ npx skills add jpudysz/react-native-unistyles --skill unistyles-v2-to-v3-migration -a gemini-cli -y
GitHub Copilot
$ npx skills add jpudysz/react-native-unistyles --skill unistyles-v2-to-v3-migration -a github-copilot -y
OpenCode
$ npx skills add jpudysz/react-native-unistyles --skill unistyles-v2-to-v3-migration -a opencode -y
Windsurf
$ npx skills add jpudysz/react-native-unistyles --skill unistyles-v2-to-v3-migration -a windsurf -y
name: unistyles-v2-to-v3-migration description: > Migrate react-native-unistyles from v2 to v3. Triggers on: "migrate unistyles", "upgrade unistyles", "v2 to v3", "unistyles migration", "update unistyles", "convert unistyles v2". Covers all API changes including StyleSheet.create, useStyles removal, theme configuration, variants, withUnistyles, Babel plugin setup, style spreading fixes, and third-party component wrapping. disable-model-invocation: false user-invocable: true allowed-tools: Read, Grep, Glob, Edit, Write, Bash(npx *)
You are migrating a React Native codebase from react-native-unistyles v2 to v3. Follow this workflow precisely. v3 is a complete rewrite with C++ core (Nitro Modules), no re-renders, and a Babel plugin that processes StyleSheets at build time.
Follow these steps IN ORDER. Each step must be completed before moving to the next.
Install v3 together with Nitro Modules, then rebuild the native app (pods / Gradle):
yarn add react-native-unistyles@3 react-native-nitro-modules@0.37.1 # or npm / bun / pnpm
Add the Babel plugin:
// babel.config.js
module.exports = {
plugins: [
['react-native-unistyles/plugin', { root: 'src' }] // your app source root
]
}The `root` option is REQUIRED (the plugin throws without it, and it can't resolve to the project root itself). Every file under `root` is processed, no matter what it imports. Outside `root`, a file is processed only if it imports `react-native-unistyles`, contains an import listed in `autoProcessImports`, or matches `autoProcessPaths` (which always includes the two `react-native-reanimated` component paths; yours are added to them). `node_modules` is ignored unless whitelisted via `autoProcessPaths` / `autoRemapImports`.
If using React Compiler, the Unistyles plugin MUST come BEFORE React Compiler in the plugins array.
Since 3.6.0, Metro apps can use the experimental zero-config Metro integration instead: `module.exports = withUnistylesConfig(getDefaultConfig(__dirname))` with `withUnistylesConfig` from `react-native-unistyles/metro`, and no Unistyles entry in `babel.config.js` (having both throws). It needs no `root`/`autoProcess*` options, covers `node_modules` and tracks StyleSheet dependencies at runtime (no Babel transform). With it, `useVariants` must use the returned styles: `const variantStyles = styles.useVariants({ size })`. The Babel plugin stays the default.
If the app is bundled with Re.Pack, don't add the plugin to `babel.config.js` — use `RepackUnistylePlugin` from `react-native-unistyles/repack-plugin` with `unistylesPluginOptions: { root: 'src' }` instead.
- import { UnistylesRegistry } from 'react-native-unistyles'
+ import { StyleSheet } from 'react-native-unistyles'
- UnistylesRegistry
- .addThemes({ light: lightTheme, dark: darkTheme })
- .addBreakpoints({ sm: 0, md: 768, lg: 1200 })
- .addConfig({
- adaptiveThemes: true,
- initialTheme: 'dark',
- plugins: [myPlugin],
- experimentalCSSMediaQueries: true,
- windowResizeDebounceTimeMs: 100,
- disableAnimatedInsets: true
- })
+ StyleSheet.configure({
+ themes: { light: lightTheme, dark: darkTheme },
+ breakpoints: { sm: 0, md: 768, lg: 1200 },
+ settings: {
+ adaptiveThemes: true // OR initialTheme: 'dark' - never both
+ }
+ })**Removed settings:** `plugins`, `experimentalCSSMediaQueries` (now always on), `windowResizeDebounceTimeMs` (no debounce), `disableAnimatedInsets` (insets no longer re-render).
**v3 `settings` accepts exactly:** `adaptiveThemes`, `initialTheme`, `CSSVars` (web), `nativeBreakpointsMode` (`'pixels'` default | `'points'`). Any other key throws. `initialTheme` together with `adaptiveThemes: true` throws (mutually exclusive), `adaptiveThemes` requires both `light` and `dark` themes, and the first breakpoint must be `0`. Call `StyleSheet.configure` before any `StyleSheet.create` is evaluated (import the config file first in your entry point).
Unistyles `StyleSheet` is a full polyfill of React Native's `StyleSheet` — it includes `hairlineWidth`, `compose`, `flatten`, `absoluteFill`, and `absoluteFillObject`. You should replace **all** `import { StyleSheet } from 'react-native'` with `import { StyleSheet } from 'react-native-unistyles'` so you have a single import.
- import { StyleSheet } from 'react-native'
- import { createStyleSheet } from 'react-native-unistyles'
+ import { StyleSheet } from 'react-native-unistyles'
- const stylesheet = createStyleSheet(theme => ({
+ const styles = StyleSheet.create(theme => ({
container: {
backgroundColor: theme.colors.background
}
}))- import { useStyles } from 'react-native-unistyles'
const MyComponent = () => {
- const { styles, theme } = useStyles(stylesheet)
return <View style={styles.container} />
}Styles created with `StyleSheet.create` are used directly - no hook needed. The Babel plugin handles reactivity at build time.
Dynamic functions (`styles.box(width, color)`) keep working, but their arguments must be serializable (strings, numbers, boolean
Guide for using react-native-unistyles v3. Triggers on: "unistyles", "StyleSheet.create", "create stylesheet", "add theme",…
Decompile Android APK, XAPK, JAR, and AAR files using jadx or Fernflower/Vineflower. Reverse engineer Android apps, extract HTTP…