pmndrs / drei

🥉 useful helpers for react-three-fiber
https://drei.pmnd.rs/
MIT License
7.85k stars 641 forks source link

View children no access to React Contexts #1961

Open shalanah opened 1 month ago

shalanah commented 1 month ago

What is your question:

I'm having issues with child components of View accessing React Context. Any workarounds for this?

I know I stumbled into a similar issue with the Html element once too but found a workaround here https://github.com/pmndrs/drei/issues/1137#issuecomment-1307474176 .

shalanah commented 1 month ago

I have a codesandbox with the issue: https://codesandbox.io/p/sandbox/view-context-rhk4j2?file=%2Fsrc%2FApp.tsx%3A8%2C11

Uncomment line 7 and context is still null.

shalanah commented 1 month ago

As a band-aid I'm able to directly wrap the children in a provider - works for my purposes but isn't as clean as the provider working properly and having all children have access.