react-native-sensor-manager
react-native-sensor-manager copied to clipboard
NativeModules.SensorManger is undefined
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);
});
I fixed it with these steps:
https://github.com/kprimice/react-native-sensor-manager/issues/12#issuecomment-241688865
maybe update the readme?
didn't solve the problem in my case