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.

Yuri van Geffen
  • 853
  • 1
  • 7
  • 21
  • 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. – Giuseppe Pennisi Jun 23 '20 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! – Yuri van Geffen Sep 28 '20 at 08:28

0 Answers0