Home > Software engineering >  React-Native - Beacon Manager - undefined is not an object
React-Native - Beacon Manager - undefined is not an object

Time:12-10

I get an error if i use the following code. I have run a "pod install", link the library manually. Nothing works.

  • React-Native Version: 0.69.0
  • Library-Version: 1.0.7
import React, {Component} from 'react';

import {
    Text,
    TouchableOpacity, View
} from 'react-native';

// @ts-ignore
import {Beacons} from 'react-native-beacons-manager';


export default class App extends Component {
    componentDidMount() {
        Beacons.requestWhenInUseAuthorization();
        // Beacons.requestAlwaysAuthorization();
        // Beacons.allowsBackgroundLocationUpdates(true);
    }

    render() {
        return (
            <View>
                <Text style={{color: 'white', top: 150}}>test</Text>
            </View>
        )
    }
};

Does somebody know why the error occurs?

CodePudding user response:

This library doesn't support new versions of react native. You need to use this fork https://github.com/MacKentoch/react-native-beacons-manager/issues/249 or this fork https://github.com/MacKentoch/react-native-beacons-manager/issues/228#issuecomment-964131282 depends on your need

  • Related