How to Setup Expo with NativeWind
Fernando Chaves
July 21, 2024

npx create-expo-app my-nativewind-project
cd my-nativewind-project
npm install nativewind
npm install --save-dev tailwindcss
npx tailwindcss init
module.exports = {
content: ["./App.{js,jsx,ts,tsx}", "./src/**/*.{js,jsx,ts,tsx}"],
theme: {
extend: {},
},
plugins: [],
};
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: ["nativewind/babel"],
};
};
import { Text, View } from 'react-native';
export default function App() {
return (
<View className="flex-1 items-center justify-center bg-white">
<Text className="text-xl font-bold text-blue-500">
Welcome to Expo with NativeWind!
</Text>
</View>
);
}