Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot start expo after installing NativeWInd v4 #871

Open
script8888 opened this issue Apr 6, 2024 · 2 comments
Open

Cannot start expo after installing NativeWInd v4 #871

script8888 opened this issue Apr 6, 2024 · 2 comments

Comments

@script8888
Copy link

Describe the bug
When I run yarn run ios, I get this error in terminal:

tailwindcss(ios) rebuilding... tailwindcss(ios) is taking a long time to build, 
please read https://tailwindcss.com/docs/content-configuration#pattern-recommendations to 
speed up your build time

To Reproduce
Steps to reproduce the behavior:

Expected behavior
App preview is supposed to load up.

Screenshots
This is what my expo app shows up.
image

Files:
my global.css is located at the root dir of the project

// tailwind.config.js

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["./app/**/*.{js,jsx,ts,tsx}", "./components/**/*.{js,jsx,ts,tsx}"],
  presets: [require("nativewind/preset")],
  theme: {
    extend: {},
  },
  plugins: [],
};
// babel.config.js

module.exports = function (api) {
  api.cache(true);
  return {
    presets: [
      ["babel-preset-expo", { jsxImportSource: "nativewind" }],
      "nativewind/babel",
    ],
    plugins: [
      // Required for expo-router
      "expo-router/babel",
      "react-native-reanimated/plugin",
    ]
  };
};
// metro.config.js

// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require("expo/metro-config");
const { withNativeWind } = require("nativewind/metro");

/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname, { isCSSEnabled: true });

module.exports = withNativeWind(config, { input: "./global.css" });
@Aycom366
Copy link

Aycom366 commented Apr 6, 2024

expo already added the reanimated plugin to their babel-preset-expo, so you don't have to set that again provided you're using SDK 50, and of cause, This might not fix it.

@agrittiwari
Copy link


TypeError: withNativeWind is not a function
TypeError: withNativeWind is not a function
    at Object.<anonymous> (/Users/agrittiwari/OpenSource/devStory/metro.config.js:10:18)
    at Module._compile (node:internal/modules/cjs/loader:1375:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1434:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1234:19)
    at require (node:internal/modules/helpers:176:18)
    at module.exports (/Users/agrittiwari/OpenSource/devStory/node_modules/import-fresh/index.js:28:9)
    at loadJs (/Users/agrittiwari/OpenSource/devStory/node_modules/cosmiconfig/dist/loaders.js:9:18)
    at Explorer.loadFileContent (/Users/agrittiwari/OpenSource/devStory/node_modules/cosmiconfig/dist/createExplorer.js:230:12)

how to add nativewind/metro, if you've added this in package.json @script8888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants