Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React, { Component } from 'react'
import { View, Platform } from 'react-native'
import { Accelerometer } from 'react-native-sensors';
const accelerationObservable = new Accelerometer({
updateInterval: 100, // defaults to 100ms
});
// Values for scale
let ACCELEROMETER_MIN = Platform.OS === 'ios' ? 1 : -10
let ACCELEROMETER_MAX = Platform.OS === 'ios' ? -1 : 10
export default class ImaginationWrapper extends Component {
state: {accelerometerData: Object}
constructor (props: *) {
super(props)
this.state = {
accelerometerData: {x:0, y:0, z:0}
}
constructor() {
super();
this.accelerometer = new Accelerometer({ updateInterval: 16 });
}
type => Sensors.SensorTypes[type],
);
type => Sensors.setUpdateIntervalForType(
type,
(1000 / sampleInterval),
),
)