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

  1. react-native: 068.0
  2. react: 17.0.2
  3. beacon library: 1.1.0
  4. pod. 1.11.3
  5. npm: 9.2.0
  6. node: 18.1.0

Steps to reproduce

  1. react-native init myTestApp --version=0.68.0
  2. Add library version 1.1.0 (“react-native-beacons-manager”: “git://github.com/MacKentoch/react-native-beacons-manager.git#53c1bda”)
  3. cd ios && pod install
  4. 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

Most upvoted comments

Hi @iSaBo96

Did the same thing after doing some changes according to your instruction we got the following error

image

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 of import {Beacons} from 'react-native-beacons-manager';