react-native-sensor-manager icon indicating copy to clipboard operation
react-native-sensor-manager copied to clipboard

NativeModules.SensorManger is undefined

Open FezVrasta opened this issue 7 years ago • 2 comments

I followed the steps, ran react-native run-android, but when I call NativeModules.SensorManager, it's undefined.

Ideas?

import { DeviceEventEmitter, NativeModules } from 'react-native';

const mSensorManager = NativeModules.SensorManager;

mSensorManager.startLightSensor(100);
DeviceEventEmitter.addListener('LightSensor', ({ light }) => {
  console.log(light);
});

FezVrasta avatar Oct 24 '16 13:10 FezVrasta

I fixed it with these steps:

https://github.com/kprimice/react-native-sensor-manager/issues/12#issuecomment-241688865

maybe update the readme?

FezVrasta avatar Oct 24 '16 13:10 FezVrasta

didn't solve the problem in my case

ancodeUDW avatar Feb 24 '18 20:02 ancodeUDW