Skip to content

ThemeProvider doesn't pass theme to @emotion/styled context #1531

@inadeqtfuturs

Description

@inadeqtfuturs

Describe the bug
Using theme-ui's provider ThemeProvider and following the styled documentation, I'm unable to get access to the theme in the styled context.

To Reproduce
Steps to reproduce the behavior:
https://codesandbox.io/s/themeui-context-sharing-jhsto?file=/src/App.js

This code sandbox is passing a theme object to the theme-ui ThemeProvider. I'm stringifying the theme context provided by @emotion's useTheme hook and theme-ui's useThemeUI hook. The theme object @emotion returns is empty, but theme-ui has the object.

Expected behavior
@emotion's styled API should have access to the theme object passed to the theme-ui ThemeProvider.

Screenshots
Screen Shot 2021-02-27 at 11 02 43 AM

Additional context
I understand that a simple solution is wrapping the two individual ThemeProviders, but it would be preferable to just have the one.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions