Styled Components ThemeProvider is undefined inside Dreis HTML component

@drcmda

Hello everyone, once again reaching out regarding a potential bug (or useage error on my part).

Pretty fringe case but it’s blocking me, so hopefully someone could let me know if they have any ideas.

Basically: Using styled-components ThemeProvider doesn’t work if the HTML is inside Dreis HTML component.

A simple sandbox can be seen here.

Any ideas?

Thanks so much, Kyle

PS. I forked another sandbox of mine so the description/thumbnail is incorrect

this is unfortunate but context does not work across renderers. you can forward them, either manually or if you have many and it becomes too much of a burden GitHub - pmndrs/drei: 🥉 useful helpers for react-three-fiber with all these solutions you will have to access the root context.

it gets even worse. html is also a separate renderer (or root, as in, in dev tools you would see as a separate entry). so you’re basically passing the context through 3 renderers.

1 Like

Yeah that works well, thanks mate