Closed faelsoto closed 3 months ago
This is expected because the Html component is inside a separate React Reconciler or in any other way does not inherit the React Context of it's parent.
You can explicitly pass the Remotion Contexts to the child:
const contexts = Internals.useRemotionContexts();
return (
<group position={[0, 0.05, -0.75]} rotation={[0, rotation, 0]}>
<mesh position={[0, 0.05, -0.7]}>
<boxGeometry args={[2, 2, 0.1]} />
<meshStandardMaterial color="#f00" />
<Html transform portal={portalTarget}>
<Internals.RemotionContextProvider contexts={contexts}>
<Content />
</Internals.RemotionContextProvider>
</Html>
</mesh>
</group>
);
This is not officially supported and may break. Maybe we turn it into an official API once.
Not sure if this is a bug or not, but we're trying to do some animations inside a
<ThreeCanvas>
with html using drei's<Html>
component, but the thing we're finding is that when we calluseCurrentFrame
we're getting this error:Initially we thought it was because
<Html>
needs to mount its elements somewhere, and by default it puts it in the root node, so we used itsportal
prop to make sure it's still inside the composition, but it still is not working and we're getting the same error.Here's a reproduction script.
We've looked everywhere but it seems we're the only ones trying this stuff.
The way we've solved it so far is passing the
frame
from the Box to the Content component, that works but it feels hacky.