react-xr
react-xr copied to clipboard
is there a reason this ships a canvas?
for reference https://github.com/pmndrs/react-xr/blob/master/src/XR.tsx#L315-L324
export const XRCanvas = React.forwardRef<HTMLCanvasElement, XRCanvasProps>(function XRCanvas(
{ foveation, referenceSpace, onSessionStart, onSessionEnd, onVisibilityChange, onInputSourcesChange, children, ...rest },
forwardedRef
) {
return (
<Canvas {...rest} ref={forwardedRef}>
<XR
foveation={foveation}
referenceSpace={referenceSpace}
onSessionStart={onSessionStart}
onSessionEnd={onSessionEnd}
onVisibilityChange={onVisibilityChange}
onInputSourcesChange={onInputSourcesChange}
>
<InteractionManager>{children}</InteractionManager>
</XR>
</Canvas>
)
})
i find this slightly confusing, it doesn't seem to do much with it either, just forwarding props.
wouldn't it be better to just export <Xr>, similar to <Physics>, <Bounds>, <Flex> and all the other provider components in the eco system? that would also make it easier to use and things could probably have better interop.
what do you think @sniok @codynova
Interesting, I wasn't aware of these providers. I don't see any difference in interop, just API consistency. Previously this canvas would modify R3F a bit but that's gone away with v8. It's just the provider that's left. I think we can combine XR and InteractionManager and encourage people to use that instead. XR can be exported in a minor and be used as:
<XRButton mode="VR" />
<Canvas>
<XR>
// ...
<XR>
</Canvas>
yes, that would make much more sense imo. i can import bounds, physics, and all the other stuff and just use it, but xr i have to change canvases. i think that change can be made without waiting for other stuff, new major export xr which includes the interaction manager, and that brings it in line with the eco system again.
Detailed in v5.0.0.