grommet / grommet-site

Site for Grommet v2
Apache License 2.0
32 stars 67 forks source link

Breaking error when using Anchor or Text components - Uncaught TypeError: defaultValidatorFn is not a function #487

Closed MendelBak closed 1 year ago

MendelBak commented 1 year ago

I have a brand new react/Vite project and when I add a simple Anchor or Text component the site crashes with the below error message.

  "dependencies": {
    "framer-motion": "^10.16.0",
    "grommet": "^2.33.1",
    "grommet-icons": "^4.11.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "styled-components": "^6.0.7"
  },
  "devDependencies": {
    "@types/react": "^18.0.15",
    "@types/react-dom": "^18.0.6",
    "@typescript-eslint/eslint-plugin": "^5.33.0",
    "@typescript-eslint/parser": "^5.33.0",
    "@vitejs/plugin-react": "^3.0.0",
    "autoprefixer": "^10.4.8",
    "eslint": "^8.21.0",
    "eslint-config-standard": "^17.0.0",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-n": "^15.2.4",
    "eslint-plugin-promise": "^6.0.0",
    "eslint-plugin-react": "^7.30.1",
    "postcss": "^8.4.16",
    "tailwindcss": "^3.1.8",
    "typescript": "^4.6.4",
    "vite": "^4.0.1",
    "vite-plugin-eslint": "^1.8.1"
  }

image

MikeKingdom commented 1 year ago

Grommet doesn't currently support styled-components v6. There is work in progress to support v6.

MendelBak commented 1 year ago

So, I need to revert to v5?

MendelBak commented 1 year ago

I just tried with version 5.3.10 and the same failure persists. Which version does Grommet work with?

I checked the Grommet package.json and it specifies v5.1.0. I tried installing that, clearing my node_modules and reinstalling but the error is still there.

MikeKingdom commented 1 year ago

Be sure to clear out your node_modules. It should work fine with most v5 versions. For example I'm using 5.3.11 in one situation as we speak.

MendelBak commented 1 year ago

Clearing it out again worked. Cheers mate! Thanks for the help!