transistorsoft / react-native-background-geolocation-firebase

Firebase Adapter for React Native Background Geolocation
24 stars 4 forks source link

TypeError: RNBackgroundGeolocation.registerPlugin is not a function #4

Closed DalerAsrorov closed 6 years ago

DalerAsrorov commented 6 years ago

Installed the module following the guide. The app runs fine but there is an error that seems like it won't allow the proxy to run properly.

I placed the following in componentDidMount:

    BackgroundGeolocationFirebase.configure({
      geofencesCollection: "geofences"
    }).then(() => {
      console.log('success');
    }).catch((error: Error) => {
      console.log(error);
    });

...

    BackgroundGeolocation.ready(
      {

The error I see in console:

TypeError: RNBackgroundGeolocation.registerPlugin is not a function
    at NativeModule.js:34
    at tryCallTwo (core.js:45)
    at doResolve (core.js:200)
    at new Promise (core.js:66)
    at Function.configure (NativeModule.js:29)
    at Function.configure (index.js:18)
    at BackgroundLocation.componentDidMount (BackgroundLocation.tsx:47)
    at commitLifeCycles (ReactNativeRenderer-dev.js:11458)
    at commitAllLifeCycles (ReactNativeRenderer-dev.js:12670)
    at Object.invokeGuardedCallback (ReactNativeRenderer-dev.js:39)

Not sure what I am doing wrong. Any suggestions?

A few notes on the doc: After adding Firebase import and instantiation to AppDelegate.m, the user should run pod install.

DalerAsrorov commented 6 years ago

The issue was resolved after I updated ReactNativeBackgroundGeolocation from 2.12.2 to 2.13.3. Thanks!

christocracy commented 6 years ago

Yes, 2.13.x is required.