Open moroneyk opened 6 years ago
Unsure if this will work, as I have been trying to implement it myself. But through MDN documentation on WebVR they mention an event listener as follows...
window.addEventListener('vrdisplaypresentchange', () => { if(VRDisplay.isPresenting) { console.warn('Display has started presenting.'); } else { console.warn('Display has stopped presenting.'); } });
Bug : onEnterVR / inVR no longer works
When pressing the 'View in VR' button no event is fired to tell us we are in VR. Normally listening for a onEnterVR / onExitVR would let us know if the user has entered or exited VR mode.
This even should be fired from VRInstance.js from the _onEnterVR() and _onExitVR() functions as the user enters/exits VR. Code is below:
Expected behavior
Listening for an 'onEnterVR' or 'onExitVR' event should let us know if the user has entered/exited VR mode.
Actual behaviour
'onEnterVR' or 'onExitVR' events are never fired by VRInstance
Reproduction
Add an RCTDeviceEventEmitter listener for 'onEnterVR' or 'onExitVR' to any project. Then enter exit VR Mode. No events are intercepted.
Solution
Ensure the 'onEnterVR' or 'onExitVR' calls are fired when entering exiting VR, or document any other recommended methods to determine if the user has entered/exited VR.
Additional Information