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

"No theme provided" error #44

Open
edbentinck opened this issue Oct 20, 2019 · 0 comments
Open

"No theme provided" error #44

edbentinck opened this issue Oct 20, 2019 · 0 comments

Comments

@edbentinck
Copy link

edbentinck commented Oct 20, 2019

Package Versions:

I have just started a new project using babel-plugin-tailwind-components, and trying to use prop variables for dynamic component styling:

const Button = styled.button`
  ${({ pill }) => pill && tw`
    rounded-full
  `}

  ${tw`
    py-1
    px-3
    text-sm
    text-gray-700
    bg-gray-400
    hover:bg-gray-500
  `}
`

The snippet above produces a console error stating that the component ...references the 'theme' prop in its styles but no theme was provided via prop or <ThemeProvider>. I assume this is because at run-time dynamic styles are compiled to something along the lines of:

"marginBottom": _tailwindConfig.theme.margin["8"],

Static styles such as flex or text-center don't cause this error to be returned, since they aren't dependent on custom configurations.

Is there any way to avoid this error being produced?

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

1 participant