1

I have a React app running on a server that uses some React 360 components. One of the components has a button with an onClick event which points to a method askPermission(). I'm trying to have the method ask permission to use the DeviceOrientationEvent as described in this article. Unfortunately window.DeviceOrientationEvent is undefined in this method, which makes it impossible to request permission. I'm outputting window, and it is defined:

askPermission = function () { console.log('asking permission') //outputted console.log(window) //object console.log(window.DeviceOrientationEvent) //undefined ... } render() { return ( ... <VrButton onClick={askPermission}> ... </VrButton> ... ); } 

Is there something specific to Safari (on iOS 13.x) that makes DeviceOrientationEvent unavailable? What could be the reason and how could I access this property?

EDIT: I tried the same on Chrome (on Android), and it also doesn't have the DeviceOrientationEvent property on window.

2
  • Hi Yuri, I don't know if you had resolved the problem, but I got the same problem. I'm thinking that it is necessary to call that function from a native module, not from a component. I'll update my comment after some tries. Commented Jun 23, 2020 at 17:31
  • @GiuseppePennisi I haven't fixed this in the end and turned to a different library to run VR, would still be curious to if you figured it out! Commented Sep 28, 2020 at 8:28

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.