react-native-beacons-manager: App throws an error after run initial with a minimal example
Version
1.1.0
Platform
iOS
OS version
iOS 13
General versions
- react-native: 068.0
- react: 17.0.2
- beacon library: 1.1.0
- pod. 1.11.3
- npm: 9.2.0
- node: 18.1.0
Steps to reproduce
- react-native init myTestApp --version=0.68.0
- Add library version 1.1.0 (“react-native-beacons-manager”: “git://github.com/MacKentoch/react-native-beacons-manager.git#53c1bda”)
- cd ios && pod install
- add minimal example
import React from 'react';
import {Text, View} from 'react-native';
import {Beacons} from 'react-native-beacons-manager';
const App = ({route, navigation}) => {
Beacons.requestAlwaysAuthorization();
Beacons.allowsBackgroundLocationUpdates(true);
return (
<View>
<Text style={{color: 'white', top: 150}}>test</Text>
</View>
);
};
export default App;
Expected behavior
The app should be started successfully
Actual behavior
I get the following errors:
Error: Requiring module "node_modules/react-native-beacons-manager/index.js", which threw an exception: Invariant Violation: `new NativeEventEmitter()` requires a non-null argument.
TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[2], "react-native-beacons-manager").Beacons')
I have used the library several times in my projects. But now I get the mentioned error and don’t know why. I have even created a minimal example. This is described above. But still I have the error. Does anyone know why?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 25
I have experienced the same issue and I was able to solve it by following this https://github.com/facebook/react-native/issues/27840#issuecomment-623052433
Beacons is default export. Try
import Beacons from 'react-native-beacons-manager';
instead ofimport {Beacons} from 'react-native-beacons-manager';