mirror of
https://github.com/zhigang1992/nativewind.git
synced 2026-06-10 23:58:57 +08:00
961 B
961 B
import StartCoding from "../_start-coding.md"
Create React Native App
1. Create a new React Native application
npx create-react-native-app my-nativewind-app
Choose "Default new app" and then move into the project's directory.
cd my-nativewind-app
You will need to install nativewind and it's peer dependency tailwindcss.
yarn add nativewind
yarn add --dev tailwindcss
2. Setup Tailwind CSS
Run npx tailwindcss init to create a tailwind.config.js file
Add the paths to all of your component files in your tailwind.config.js file.
// tailwind.config.js
module.exports = {
- content: [],
+ content: ["./App.{js,jsx,ts,tsx}", "./screens/**/*.{js,jsx,ts,tsx}"],
theme: {
extend: {},
},
plugins: [],
}
3. Add the Babel plugin
Modify your babel.config.js
// babel.config.js
module.exports = {
- plugins: [],
+ plugins: ["nativewind/babel"],
};