[js][core] added `nativeModuleExists` property to all module statics - true or false if the native android/ios module is present
This commit is contained in:
parent
e3f0213aaa
commit
67985f8e90
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue