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

NativeModules Error

Open uendar opened this issue 5 years ago • 2 comments

Error: Unable to resolve module NativeModules from ......../app: NativeModules could not be found within the project.

I am using

"react": "16.9.0",
 "react-native": "0.61.5",

uendar avatar Mar 10 '20 09:03 uendar

Use This code its working for me import {DeviceEventEmitter, NativeModules, } from 'react-native'; const mSensorManager = NativeModules.SensorManager; constructor() { super(); mSensorManager.startLightSensor(1000);

DeviceEventEmitter.addListener('LightSensor', function(data) {
  console.log('Light === ', data);
});

}

arbab-io avatar Mar 11 '20 11:03 arbab-io

Use This code its working for me import {DeviceEventEmitter, NativeModules, } from 'react-native'; const mSensorManager = NativeModules.SensorManager; constructor() { super(); mSensorManager.startLightSensor(1000);

DeviceEventEmitter.addListener('LightSensor', function(data) {
  console.log('Light === ', data);
});

}

THANKS!!!!!

williamniemiec avatar Aug 28 '21 00:08 williamniemiec