window.DeviceOrientationEvent is undefined in Safari on iOS (React web-app)

383 Views Asked by At

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.

0

There are 0 best solutions below