admin管理员组文章数量:1332345
Just starting off working on a React Native project, when installing packages, I couldn't get the effects to work... not sure if it's a problem with my configs or setup.
Here is my code:
Inside app file:
index.tsx
import { Text, View } from "react-native";
import { Link } from 'expo-router';
export default function Index() {
return (
<View className="items-center">
<Text className="text-10xl font-bold text-red-500">
Hello, TailwindCSS with NativeWind! weofijweojweoifjwaiojfaoifjaew
</Text>
</View>
);
}
---
_layout.tsx
import { Text, View } from 'react-native';
import { Slot, Stack } from 'expo-router';
import { StackActions } from '@react-navigation/native';
import React from 'react';
import "./global.css";
const RootLayout = () => {
return (
<Stack>
<Stack.Screen name="index" options = {{ headerShown: false }} />
</Stack>
)
}
export default RootLayout
---
global.css
@tailwind base;
@tailwind components;
@tailwind utilities;
Outside of app file:
tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./App.{js,jsx,ts,tsx}",
"./screens/**/*.{js,jsx,ts,tsx}",
"./components/**/*.{js,jsx,ts,tsx}",
],
theme: {
extend: {},
},
plugins: [],
};
---
babel.config.js
module.exports = function (api) {
api.cache(true);
return {
presets: [
["babel-preset-expo", { jsxImportSource: "nativewind" }],
"nativewind/babel",
],
};
};
---
metro.config.js
const { getDefaultConfig } = require("expo/metro-config");
const { withNativeWind } = require('nativewind/metro');
const config = getDefaultConfig(__dirname);
module.exports = withNativeWind(config, { input: './global.css' });
---
nativewind-env.d.ts
/// <reference types="nativewind/types" />
I followed a few utube vids and the dos from native wind, can only display the text in index.tsx without any styles.
I've also tried
- to clear the cache
- to check if packages are installed
本文标签: react nativeExpoReactNativeNativeWind className effects not workingStack Overflow
版权声明:本文标题:react native - Expo-ReactNative-NativeWind: className effects not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742326785a2453882.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论