Index of every page on this site: llms.txt
All skills
tristanmanchester avatar

/styling-nativewind-v4-expo

@3323bc9
Run it yourself

Set up, repair, and build components with NativeWind v4 and Tailwind CSS v3 in Expo React Native apps. Use for an explicitly v4 project, v4 configuration failures, className interoperability, or v4 theming; not for NativeWind v5 or generic web Tailwind setup.

Use this Skill: https://skilld.dev/gh/tristanmanchester/agent-skills/styling-nativewind-v4-expo

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencestheming-dark-mode.md

≈557 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Theming + dark mode (NativeWind v4)

Dark mode: system vs manual

  • Read system preference via useColorScheme().
  • Allow user override via colorScheme.set("light" | "dark" | "system").

Expo note: to follow system appearance, set userInterfaceStyle to automatic in app.json.

Minimal toggle

import { useState } from "react";
import { Pressable, Text, View } from "react-native";
import { colorScheme } from "nativewind";

export function ThemeToggle() {
  const [current, setCurrent] = useState<"light" | "dark">("light");
  return (
    <View className="items-center">
      <Pressable
        onPress={() => {
          const next = current === "light" ? "dark" : "light";
          setCurrent(next);
          colorScheme.set(next);
        }}
      >
        <Text className="font-semibold">{current}</Text>
      </Pressable>
    </View>
  );
}

Dynamic themes with CSS variables

1) Define colours in tailwind.config.js

Create theme colours that point at CSS variables:

module.exports = {
  theme: {
    colors: {
      primary: "rgb(var(--color-primary) / <alpha-value>)",
      secondary: "rgb(var(--color-secondary) / <alpha-value>)",
    },
  },
};

Set defaults on :root (via Tailwind addBase) if you want stable defaults:

plugins: [
  ({ addBase }) =>
    addBase({
      ":root": {
        "--color-primary": "0 0 0",
        "--color-secondary": "255 255 255",
      },
    }),
];

2) Override variables at runtime with vars()

import { vars, useColorScheme } from "nativewind";
import { Text, View } from "react-native";

const themes = {
  brand: {
    light: vars({ "--color-primary": "0 0 0", "--color-secondary": "255 255 255" }),
    dark: vars({ "--color-primary": "255 255 255", "--color-secondary": "24 24 27" }),
  },
};

export function ThemedCard({ children }: { children: React.ReactNode }) {
  const { colorScheme } = useColorScheme();
  return (
    <View style={themes.brand[colorScheme]} className="rounded-xl bg-secondary p-4">
      <Text className="text-primary">{children}</Text>
    </View>
  );
}

Guideline: keep your “theme contract” small (a handful of variables), then build design tokens around it.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning1mo5 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill provides comprehensive configuration guides and templates for setting up NativeWind v4 in Expo projects. Analysis identified minor security risks, including the recommendation to use a third-party project initialization tool and the potential for indirect prompt injection when auditing repository files for configuration errors.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

  • Runlayer8mo

    6/6 files flagged

  • ZeroLeaks6mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 3323bc9. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Steadyupdated last month
metadata
{
  "version": "2.0.0",
  "reviewed": "2026-09-13"
}
Other metadata
compatibility
An Expo project using nativewind major 4 and tailwindcss major 3. Native peer versions must match the project's Expo SDK.

README badge

README badge for tristanmanchester/agent-skills/styling-nativewind-v4-expo