diff --git a/lib/firebase-app.js b/lib/firebase-app.js index 4ae40171..0c91cfa1 100644 --- a/lib/firebase-app.js +++ b/lib/firebase-app.js @@ -1,6 +1,7 @@ import { NativeModules } from 'react-native'; import INTERNALS from './internals'; +import { capitalizeFirstLetter } from './utils'; import AdMob, { statics as AdMobStatics } from './modules/admob'; import Auth, { statics as AuthStatics } from './modules/auth'; @@ -127,7 +128,9 @@ export default class FirebaseApp { return this._namespaces[_name]; }; - Object.assign(getInstance, statics); + Object.assign(getInstance, statics, { + nativeModuleExists: !!NativeModules[`RNFirebase${capitalizeFirstLetter(name)}`], + }); return getInstance; } } diff --git a/lib/firebase.js b/lib/firebase.js index 85e02e77..97f3fd2a 100644 --- a/lib/firebase.js +++ b/lib/firebase.js @@ -4,7 +4,7 @@ */ import { NativeModules, NativeEventEmitter } from 'react-native'; -import { isObject, isString } from './utils'; +import { isObject, isString, capitalizeFirstLetter } from './utils'; import INTERNALS from './internals'; import PACKAGE from './../package.json'; @@ -216,7 +216,9 @@ class FirebaseCore { return INTERNALS.APPS[_app.name][namespace](_app); }; - Object.assign(getNamespace, statics); + Object.assign(getNamespace, statics, { + nativeModuleExists: !!NativeModules[`RNFirebase${capitalizeFirstLetter(namespace)}`], + }); return getNamespace; }