Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
95
rated 0 times [  101] [ 6]  / answers: 1 / hits: 5211  / 2 Years ago, fri, september 2, 2022, 12:00:00

NativeWind it's not working.
It was working when the content of the file tailwind.config.js was './App,{js,jsx,ts,tsx}' but not anymore since I implemented the React Navigation.


tailwind.config.js:


/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./App.{js,jsx,ts,tsx}", "./screens/**/*.{js,jsx,ts,tsx}"],
theme: {
extend: {},
},
plugins: [],
}

package.json:


{
"name": "inovarlagos",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"@react-navigation/native": "^6.0.12",
"@react-navigation/native-stack": "^6.8.0",
"expo": "~46.0.9",
"expo-status-bar": "~1.4.0",
"nativewind": "^2.0.7",
"react": "18.0.0",
"react-native": "0.69.5",
"react-native-safe-area-context": "4.3.1",
"react-native-screens": "~3.15.0"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"tailwindcss": "^3.1.8"
},
"private": true
}

App.js:


import * as React from 'react';
import { View, Text } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import HomeScreen from './screens/HomeScreen';

const Stack = createNativeStackNavigator();

function App() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" component={HomeScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}

export default App;

./screens/HomeScreen.js:


import { View, Text } from 'react-native';
import React from 'react';

const HomeScreen = () => {
return (
<View className="flex-1 items-center justify-center bg-black">
<Text className="text-red-200">Futuristik Lagos- Home</Text>
</View>
);
};

export default HomeScreen;

Project structure:


Project


Result (TailWind not working):


enter


More From » reactjs

 Answers
7

I assume you're using NativeWind, since support for TailwindCSS ended for React Native recently.


First stop the expo server. Then, instead of starting it with expo start, run expo start -c to wipe the cache that NativeWind adds and restart the server.


Source: https://www.nativewind.dev/guides/troubleshooting


[#32] Tuesday, July 19, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tyreem

Total Points: 540
Total Questions: 94
Total Answers: 90

Location: Palestine
Member since Tue, Jul 20, 2021
3 Years ago
tyreem questions
;