Skip to content

Commit 79a9e3e

Browse files
committed
tailwind setup and config
1 parent 94f3071 commit 79a9e3e

8 files changed

+28
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ yarn-error.*
3131

3232
# local env files
3333
.env*.local
34+
.env
3435

3536
# typescript
3637
*.tsbuildinfo

babel.config.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
module.exports = function (api) {
22
api.cache(true);
33
return {
4-
presets: ['babel-preset-expo'],
4+
presets: [
5+
['babel-preset-expo', { jsxImportSource: 'nativewind' }],
6+
'nativewind/babel',
7+
],
58
};
69
};

global.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;

metro.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const { getDefaultConfig } = require('expo/metro-config');
2+
const { withNativeWind } = require('nativewind/metro');
3+
4+
const config = getDefaultConfig(__dirname);
5+
6+
module.exports = withNativeWind(config, { input: './global.css' });

nativewind-env.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="nativewind/types" />

src/app/_layout.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Stack } from 'expo-router';
2+
import '../../global.css';
23

34
export default function RootLayout() {
45
return <Stack />;

src/app/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { View, Text } from 'react-native';
22

33
export default function Home() {
44
return (
5-
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
6-
<Text>Hello World</Text>
5+
<View>
6+
<Text className='text-lg font-bold text-red-500'>Hello World</Text>
77
</View>
88
);
99
}

tailwind.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** @type {import('tailwindcss').Config} */
2+
module.exports = {
3+
// NOTE: Update this to include the paths to all of your component files.
4+
content: ['./app/**/*.{js,jsx,ts,tsx}'],
5+
presets: [require('nativewind/preset')],
6+
theme: {
7+
extend: {},
8+
},
9+
plugins: [],
10+
};

0 commit comments

Comments
 (0)