用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/involvex/noobify-app --skill expo-tailwind-setup命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Complete guide for building beautiful apps with Expo Router. Covers fundamentals, styling, components, navigation, animations, patterns, and native tabs.
Add an iOS App Clip target to an Expo app. Use when the user mentions App Clip, AASA, apple-app-site-association, appclips, smart app banner, or wants to ship a lightweight iOS Clip invoked from a URL alongside their parent app.
Check the health of published EAS Updates: crash rates, install/launch counts, unique users, payload size, and the split between embedded and OTA users per channel. Use when the user asks how an update is performing, whether a rollout is healthy, how many users are on the embedded build vs OTA, or wants to gate CI on update health.
基于 SOC 职业分类
正在显示 SKILL.md
| name | expo-tailwind-setup |
| description | Set up Tailwind CSS v4 in Expo with react-native-css and NativeWind v5 for universal styling |
| version | 1.0.0 |
| license | MIT |
This guide covers setting up Tailwind CSS v4 in Expo using react-native-css and NativeWind v5 for universal styling across iOS, Android, and Web.
This setup uses:
# Install dependencies
npx expo install tailwindcss@^4 nativewind@5.0.0-preview.2 react-native-css@0.0.0-nightly.5ce6396 @tailwindcss/postcss tailwind-merge clsx
Add resolutions for lightningcss compatibility:
// package.json
{
"resolutions": {
"lightningcss": "1.30.1"
}
}
Create or update metro.config.js:
// metro.config.js
const {getDefaultConfig} = require('expo/metro-config')
const {withNativewind} = require('nativewind/metro')
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname)
module.exports = withNativewind(config, {
// inline variables break PlatformColor in CSS variables
inlineVariables: false,
// We add className support manually
globalClassNamePolyfill: false,
})
Create postcss.config.mjs:
// postcss.config.mjs
export default {
plugins: {
'@tailwindcss/postcss': {},
},
}
Create src/global.css:
@import 'tailwindcss/theme.css' layer(theme);
@import 'tailwindcss/preflight.css' layer(base);
@import 'tailwindcss/utilities.css';
/* Platform-specific font families */
@media android {
:root {
--font-mono: monospace;
--font-rounded: normal;
--font-serif: serif;
--font-sans: normal;
}
}
@media ios {
:root {
--font-mono: ui-monospace;
--font-serif: ui-serif;
--font-sans: system-ui;
--font-rounded: ui-rounded;
}
}
With Tailwind v4 and NativeWind v5, you do NOT need a babel.config.js for Tailwind. Remove any NativeWind babel presets if present:
// DELETE babel.config.js if it only contains NativeWind config
// The following is NO LONGER needed:
// module.exports = function (api) {
// api.cache(true);
// return {
// presets: [
// ["babel-preset-expo", { jsxImportSource: "nativewind" }],
// "nativewind/babel",
// ],
// };
// };
Since react-native-css requires explicit CSS element wrapping, create reusable components:
src/tw/index.tsx)import {
useCssElement,
useNativeVariable as useFunctionalVariable,
} from 'react-native-css'
import {
View as RNView,
Text as RNText,
Pressable as RNPressable,
ScrollView as RNScrollView,
TouchableHighlight as RNTouchableHighlight,
TextInput as RNTextInput,
StyleSheet,
} from 'react-native'
import Animated from 'react-native-reanimated'
import {Link as RouterLink} from 'expo-router'
import React from 'react'
// CSS-enabled Link
export const Link = (
props: React.ComponentProps<typeof RouterLink> & {className?: string},
) => {
return useCssElement(, props, {: })
}
. = .
. = .
. = .
. = .
useCSSVariable =
process.. !==
? useFunctionalVariable
:
= .< > & {
?:
}
= () => {
(, props, {: })
}
. =
= () => {
(, props, {: })
}
. =
= () => {
(, props, {
: ,
: ,
})
}
. =
= () => {
(, props, {: })
}
. =
= () => {
(, props, {: })
}
. =
= () => {
(., props, {
: ,
: ,
: ,
})
}
() {
{underlayColor, ...style} = .(props.) || {}
(
)
}
= () => {
(, props, {: })
}
. =
src/tw/image.tsx)import Animated from 'react-native-reanimated'
import {useCssElement} from 'react-native-css'
import {Image as RNImage} from 'expo-image'
import {StyleSheet} from 'react-native'
import React from 'react'
const AnimatedExpoImage = Animated.createAnimatedComponent(RNImage)
export type ImageProps = React.ComponentProps<typeof Image>
function CSSImage(props: React.ComponentProps<typeof AnimatedExpoImage>) {
// @ts-expect-error: Remap objectFit style to contentFit property
const {objectFit, objectPosition, ...style} =
StyleSheet.flatten(props.style) || {}
return (
<AnimatedExpoImage
contentFit={objectFit}
=
{}
=
=== ? { }
}
// @
=
/>
)
}
= () => {
(, props, {: })
}
. =
src/tw/animated.tsx)import RNAnimated from 'react-native-reanimated'
import * as TW from './index'
export const Animated = {
...RNAnimated,
View: RNAnimated.createAnimatedComponent(TW.View),
}
Import CSS-wrapped components from your tw directory:
import {View, Text, ScrollView, Image} from '@/tw'
export default function MyScreen() {
return (
<ScrollView className="flex-1 bg-white">
<View className="p-4 gap-4">
<Text className="text-xl font-bold text-gray-900">Hello Tailwind!</Text>
<Image
className="w-full h-48 rounded-lg object-cover"
source={{uri: 'https://example.com/image.jpg'}}
/>
</View>
</ScrollView>
)
}
Add custom theme variables in your global.css using @theme:
@layer theme {
@theme {
/* Custom fonts */
--font-rounded: 'SF Pro Rounded', sans-serif;
/* Custom line heights */
--text-xs--line-height: calc(1em / 0.75);
--text-sm--line-height: calc(1.25em / 0.875);
--text-base--line-height: calc(1.5em / 1);
/* Custom leading scales */
--leading-tight: 1.25em;
--leading-snug: 1.375em;
--leading-normal: 1.5em;
}
}
Use platform media queries for platform-specific styling:
@media ios {
:root {
--font-sans: system-ui;
--font-rounded: ui-rounded;
}
}
@media android {
:root {
--font-sans: normal;
--font-rounded: normal;
}
}
Create a CSS file for Apple semantic colors:
/* src/css/sf.css */
@layer base {
html {
color-scheme: light;
}
}
:root {
/* Accent colors with light/dark mode */
--sf-blue: light-dark(rgb(0 122 255), rgb(10 132 255));
--sf-green: light-dark(rgb(52 199 89), rgb(48 209 89));
--sf-red: light-dark(rgb(255 59 48), rgb(255 69 58));
/* Gray scales */
--sf-gray: light-dark(rgb(142 142 147), rgb(142 142 147));
--sf-gray-2: light-dark(rgb(174 174 178), rgb(99 99 102));
: (( ), ( ));
: (( / ), ( / ));
: (( ), ( ));
: (( ), ( ));
}
ios {
{
: (systemBlue);
: (systemGreen);
: (systemRed);
: (systemGray);
: (label);
: (secondaryLabel);
: (systemBackground);
: (secondarySystemBackground);
}
}
theme {
{
: (--sf-blue);
: (--sf-green);
: (--sf-red);
: (--sf-gray);
: (--sf-text);
: (--sf-text-);
: (--sf-bg);
: (--sf-bg-);
}
}
Then use in components:
<Text className="text-sf-text">Primary text</Text>
<Text className="text-sf-text-2">Secondary text</Text>
<View className="bg-sf-bg">...</View>
Use the useCSSVariable hook:
import {useCSSVariable} from '@/tw'
function MyComponent() {
const blue = useCSSVariable('--sf-blue')
return <View style={{borderColor: blue}} />
}
@tailwindcss/postcss instead of tailwindcss@import "tailwindcss/..." instead of @tailwind directives@theme in CSS instead of tailwind.config.jsuseCssElement for className supportwithNativewind with different options (inlineVariables: false)useCssElementwithNativewind appliedplatformColor() in @media ios blockslight-dark() for web/AndroidAdd className to component props:
type Props = React.ComponentProps<typeof RNView> & {className?: string}