How to use react-native-sensors - 4 common examples

To help you get started, we’ve selected a few react-native-sensors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Matzielab / imagination-react-native / components / ImaginationWrapper.js View on Github external
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}
    }
github bberak / react-native-game-engine-handbook / app / sensors / accelerometer / index.js View on Github external
constructor() {
    super();
    this.accelerometer = new Accelerometer({ updateInterval: 16 });
  }
github cawfree / react-native-sensor-fusion / index.js View on Github external
        type => Sensors.setUpdateIntervalForType(
          type,
          (1000 / sampleInterval),
        ),
      )

react-native-sensors

A developer friendly approach for sensors in react-native

MIT
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis