question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unsupported Tailwind class error

See original GitHub issue

I followed the instructions but React Native gives Unsupported Tailwind class error in the console.

Screen Shot 2022-05-02 at 18 21 30

App.js:


import { Text, View } from "react-native";
import { StatusBar } from "expo-status-bar";
import utilities from "./tailwind.json";
import { TailwindProvider, useTailwind } from "tailwind-rn";
import React from "react";

export default function App() {
  return (
    <TailwindProvider utilities={utilities}>
      <SomePage />
    </TailwindProvider>
  );
}

function SomePage() {
  const tailwind = useTailwind();

  return (
    <View style={tailwind("bg-black flex flex-1 justify-center")}>
      <Text style={tailwind("text-3xl font-bold text-white")}>hello world</Text>
      <StatusBar style="auto" />
    </View>
  );
}

tailwind.config.js

module.exports = {
  content: [],
  theme: {
    extend: {},
  },
  plugins: [],
  corePlugins: require('tailwind-rn/unsupported-core-plugins'),
}

tailwind.json

{}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

4reactions
jae1jeongcommented, May 3, 2022

paste this code in tailwind.config.js content: [‘./src/**/*.{js,jsx,ts,tsx}’], this worked for me

2reactions
panbakcommented, May 19, 2022

check your tailwind.config.js file. You may need to change content: ['./src/**/*.{js,jsx,ts,tsx}'] to content: ['./app/**/*.{js,jsx,ts,tsx}'] depending on your project folder structure. That was the case for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unsupported Tailwind class - tailwind.json is empty · Issue #156
I fixed it by setting the content option in my tailwind.config.js and run the command yarn dev:tailwind to watch for changes.
Read more >
Why is my Tailwind ract native not changing anything?
It happens because tailwind-rn generates only the CSS it is really needed and everytime you add a tailwind class to an element, ...
Read more >
Configuration - Tailwind CSS
A guide to configuring and customizing your Tailwind installation. ... Now all of Tailwind's utility classes will be generated as !important :
Read more >
tailwind-rn - Bountysource
I'm getting this error on a typescript project I'm currently working on but also occurs when initing a new typescript project. I think...
Read more >
How to use Tailwind CSS in React Native | Lag and Log
Tailwind CSS is an open-source utility-first CSS framework. It redefines the way you style applications by providing a variety of CSS classes by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found