diff --git a/zh-cn/nativewind.md b/zh-cn/nativewind.md index 929e6ef445a75d0b8a40c5b7bb0193679201b664..a34b7fcd5d903eb619e31bfbc80c9424665a03a9 100644 --- a/zh-cn/nativewind.md +++ b/zh-cn/nativewind.md @@ -79,7 +79,7 @@ module.exports = { /** @type {import('tailwindcss').Config} */ module.exports = { + content: ["./src/*.{js,jsx,ts,tsx}"], -+ presets: [require("@react-native-oh-tpl/nativewind/preset")], ++ presets: [require("@react-native-ohos/nativewind/preset")], theme: { extend: {}, }, @@ -102,8 +102,8 @@ module.exports = { ```diff module.exports = { -- plugins: [], -+ plugins: ["@react-native-ohos/nativewind/babel"], +- presets: [], ++ presets: ['module:@react-native/babel-preset'], }; ``` @@ -122,9 +122,9 @@ const config = getDefaultConfig(__dirname) + module.exports = withNativeWind(config, { input: './global.css' }) ``` -#### 创建CSS文件 global.css +#### 在工程根目录下创建CSS文件 global.css -> [!TIP] V4.1.24 创建CSS文件 global.css。 +> [!TIP] >=V4.1.24 创建CSS文件 global.css。 ``` @tailwind base; @@ -162,15 +162,17 @@ export default NativewindDemo - V4.1.24 ```jsx -import "./global.css" -import { Text, View } from "react-native"; +import "../global.css" +import { Text, View } from 'react-native'; +import { vars } from 'nativewind'; + export default function App() { return ( - - - Welcome to Nativewind! - + + + Welcome to Nativewind! + ); }