Expo.DangerZone.DeviceMotion undefined object error


#1

I am having trouble getting the Expo.DangerZone.DeviceMotion class working. I keep getting a
"TypeError: undefined is not an object (evaluating ‘Expo.DangerZone.DeviceOrientation.addListener’)"

Here are my code snippets:

from App.js:

import { DangerZone } from 'expo';
let { DeviceMotion }  = DangerZone;
...
   this._subscriptionO = Expo.DangerZone.DeviceOrientation.addListener((result) => {
      this.setState({orientationData: result});
    });

package.json:

 "dependencies": {
    "expo": "^22.0.0",
    "react": "16.0.0-beta.5",
    "react-native": "https://github.com/expo/react-native/archive/sdk-22.0.1.tar.gz"
  }

I have also tried just importing Expo from ‘expo’ but get a similar result.

I’m overlooking something obvious I’m sure. Anyone can help?


#2

In your code you have Expo.DangerZone.DeviceOrientation but you probably meant to write DeviceMotion. Try that?


#3

Der.

Thanks so much for the kind reply to an obvious error :blush:

That did the trick