chore: configure nativewind styling

This commit is contained in:
baizhi958216
2026-06-30 13:57:25 +08:00
parent c00a8c6ff6
commit c750bd4c94
9 changed files with 52 additions and 18 deletions
+7
View File
@@ -0,0 +1,7 @@
module.exports = function (api) {
api.cache(true);
return {
presets: [["babel-preset-expo", { jsxImportSource: "nativewind" }], "nativewind/babel"],
};
};
+9 -8
View File
@@ -1,20 +1,21 @@
const path = require('path');
const { getDefaultConfig } = require('expo/metro-config');
const path = require("path");
const { getDefaultConfig } = require("expo/metro-config");
const { withNativeWind } = require("nativewind/metro");
const projectRoot = __dirname;
const workspaceRoot = path.resolve(projectRoot, '..');
const workspaceRoot = path.resolve(projectRoot, "..");
const config = getDefaultConfig(projectRoot);
config.watchFolders = [workspaceRoot];
config.resolver.alias = {
...config.resolver.alias,
'@infiplot/core': path.resolve(workspaceRoot, 'packages/core/src/index.ts'),
'@infiplot/types': path.resolve(workspaceRoot, 'packages/types/src/index.ts'),
"@infiplot/core": path.resolve(workspaceRoot, "packages/core/src/index.ts"),
"@infiplot/types": path.resolve(workspaceRoot, "packages/types/src/index.ts"),
};
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, 'node_modules'),
path.resolve(workspaceRoot, 'node_modules'),
path.resolve(projectRoot, "node_modules"),
path.resolve(workspaceRoot, "node_modules"),
];
module.exports = config;
module.exports = withNativeWind(config, { input: "./src/global.css" });
+3
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.
+7 -1
View File
@@ -19,18 +19,24 @@
"expo-symbols": "~56.0.6",
"expo-system-ui": "~56.0.5",
"expo-web-browser": "~56.0.5",
"nativewind": "^4.2.6",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-native": "0.85.3",
"react-native-css-interop": "^0.2.6",
"react-native-gesture-handler": "~2.31.1",
"react-native-reanimated": "4.3.1",
"react-native-safe-area-context": "~5.7.0",
"react-native-screens": "4.25.2",
"react-native-web": "~0.21.0",
"react-native-worklets": "0.8.3"
"react-native-worklets": "0.8.3",
"tailwindcss": "^3.4.15"
},
"devDependencies": {
"@types/react": "~19.2.2",
"eslint": "^9.0.0",
"eslint-config-expo": "~56.0.4",
"prettier-plugin-tailwindcss": "^0.8.0",
"typescript": "~6.0.3"
},
"scripts": {
+1
View File
@@ -1,6 +1,7 @@
import { DarkTheme, DefaultTheme, ThemeProvider } from 'expo-router';
import { useColorScheme } from 'react-native';
import '@/global.css';
import { AnimatedSplashOverlay } from '@/components/animated-icon';
import AppTabs from '@/components/app-tabs';
-2
View File
@@ -3,8 +3,6 @@
* There are many other ways to style your app. For example, [Nativewind](https://www.nativewind.dev/), [Tamagui](https://tamagui.dev/), [unistyles](https://reactnativeunistyles.vercel.app), etc.
*/
import '@/global.css';
import { Platform } from 'react-native';
export const Colors = {
+12 -5
View File
@@ -1,9 +1,16 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--font-display:
Spline Sans, Inter, ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji,
Segoe UI Symbol, Noto Color Emoji;
Spline Sans, Inter, ui-sans-serif, system-ui, sans-serif, Apple Color Emoji,
Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
--font-mono:
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
--font-rounded: 'SF Pro Rounded', 'Hiragino Maru Gothic ProN', Meiryo, 'MS PGothic', sans-serif;
--font-serif: Georgia, 'Times New Roman', serif;
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono,
Courier New, monospace;
--font-rounded:
"SF Pro Rounded", "Hiragino Maru Gothic ProN", Meiryo, "MS PGothic",
sans-serif;
--font-serif: Georgia, "Times New Roman", serif;
}
+9
View File
@@ -0,0 +1,9 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{js,jsx,ts,tsx}", "./app/**/*.{js,jsx,ts,tsx}"],
presets: [require("nativewind/preset")],
theme: {
extend: {},
},
plugins: [],
};
+4 -2
View File
@@ -1,6 +1,7 @@
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"jsxImportSource": "nativewind",
"strict": true,
"paths": {
"@/*": [
@@ -21,6 +22,7 @@
"**/*.ts",
"**/*.tsx",
".expo/types/**/*.ts",
"expo-env.d.ts"
"expo-env.d.ts",
"nativewind-env.d.ts"
]
}
}