feat: add nativewind

This commit is contained in:
2024-11-02 00:07:04 +01:00
parent 59d819602d
commit fa5d36aa74
9 changed files with 44 additions and 6 deletions

3
app/global.css Normal file
View File

@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

View File

@@ -3,6 +3,7 @@ import { useRouter } from 'expo-router'
import { useEffect } from 'react' import { useEffect } from 'react'
import { useColorScheme, View } from 'react-native' import { useColorScheme, View } from 'react-native'
import { Button, Text } from 'react-native-paper' import { Button, Text } from 'react-native-paper'
import './global.css'
function Login() { function Login() {
const { signIn, user } = useAuth() const { signIn, user } = useAuth()

View File

@@ -1,6 +1,9 @@
module.exports = function (api: { cache: (arg0: boolean) => void }) { module.exports = function (api: { cache: (arg0: boolean) => void }) {
api.cache(true) api.cache(true)
return { return {
presets: ['babel-preset-expo'], presets: [
['babel-preset-expo', { jsxImportSource: 'nativewind' }],
'nativewind/babel',
],
} }
} }

BIN
bun.lockb

Binary file not shown.

7
metro.config.js Normal file
View File

@@ -0,0 +1,7 @@
const { getDefaultConfig } = require('expo/metro-config')
const { withNativeWind } = require('nativewind/metro')
// eslint-disable-next-line no-undef
const config = getDefaultConfig(__dirname)
module.exports = withNativeWind(config, { input: './global.css' })

3
nativewind-env.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
/// <reference types="nativewind/types" />
// NOTE: This file should not be edited and should be committed with your source code. It is generated by NativeWind.

View File

@@ -39,15 +39,17 @@
"expo-web-browser": "~13.0.3", "expo-web-browser": "~13.0.3",
"formik": "^2.4.6", "formik": "^2.4.6",
"i18n-js": "^4.4.3", "i18n-js": "^4.4.3",
"nativewind": "^4.1.21",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-native": "0.74.5", "react-native": "0.74.5",
"react-native-gesture-handler": "~2.16.1", "react-native-gesture-handler": "~2.16.1",
"react-native-paper": "^5.12.3", "react-native-paper": "^5.12.3",
"react-native-reanimated": "~3.10.1", "react-native-reanimated": "^3.16.1",
"react-native-safe-area-context": "4.10.5", "react-native-safe-area-context": "^4.14.0",
"react-native-screens": "3.31.1", "react-native-screens": "3.31.1",
"react-native-web": "~0.19.6", "react-native-web": "~0.19.6",
"tailwindcss": "^3.4.14",
"yup": "^1.4.0" "yup": "^1.4.0"
}, },
"devDependencies": { "devDependencies": {

10
tailwind.config.js Normal file
View File

@@ -0,0 +1,10 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
// NOTE: Update this to include the paths to all of your component files.
content: ['./app/**/*.{js,jsx,ts,tsx}'],
presets: [require('nativewind/preset')],
theme: {
extend: {},
},
plugins: [],
}

View File

@@ -3,8 +3,17 @@
"compilerOptions": { "compilerOptions": {
"strict": true, "strict": true,
"paths": { "paths": {
"@/*": ["./*"] "@/*": [
"./*"
]
} }
}, },
"include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts", "app/(app)/plushtml.old"] "include": [
} "**/*.ts",
"**/*.tsx",
".expo/types/**/*.ts",
"expo-env.d.ts",
"app/(app)/plushtml.old",
"nativewind-env.d.ts"
]
}