Closed okwasniewski closed 10 months ago
Try to cross-reference the WebXR/OpenXR API to see if we can find a middle ground between them and visionOS specifics. It would be nice to be able to use this API across XR devices.
@matthargett Looks like equivalent for WebXR is navigator.xr.requestSession()
we can rename the API to XR
and methods to:
Spatial.openImmersiveSpace(ID)
-> XR.requestSession(ID)
Spatial.dismissImersiveSpace()
-> XR.endSession()
WebXR returns session
object and it ends the session by calling .end()
on this object. I think the closest we can get is XR.endSession()
Summary:
This PR introduces the
XR
API.Example:
To-Do
Opening immersive space might fail in two scenarios: 1. App doesn't support multi window, user cancels the operation.
Demo
https://github.com/callstack/react-native-visionos/assets/52801365/9c985e79-5079-48e9-bbfa-e24fdc67fe67