[js][internals] _NATIVE_MODULE mapping for `nativeModuleExists`

This commit is contained in:
Salakar 2017-08-17 17:25:13 +01:00
parent 202ad29f1c
commit b4cdbef593
4 changed files with 10 additions and 6 deletions

View File

@ -129,7 +129,7 @@ export default class FirebaseApp {
};
Object.assign(getInstance, statics, {
nativeModuleExists: !!NativeModules[`RNFirebase${capitalizeFirstLetter(name)}`],
nativeModuleExists: !!NativeModules[`RNFirebase${InstanceClass._NATIVE_MODULE || capitalizeFirstLetter(name)}`],
});
return getInstance;

View File

@ -201,10 +201,11 @@ class FirebaseCore {
*
* @param namespace
* @param statics
* @param InstanceClass
* @return {function(FirebaseApp=)}
* @private
*/
_appNamespaceOrStatics(namespace, statics = {}): Function {
_appNamespaceOrStatics(namespace, statics = {}, InstanceClass): Function {
const getNamespace = (app?: FirebaseApp) => {
let _app = app;
// throw an error if it's not a valid app instance
@ -217,7 +218,7 @@ class FirebaseCore {
};
Object.assign(getNamespace, statics, {
nativeModuleExists: !!NativeModules[`RNFirebase${capitalizeFirstLetter(namespace)}`],
nativeModuleExists: !!NativeModules[`RNFirebase${InstanceClass._NATIVE_MODULE || capitalizeFirstLetter(namespace)}`],
});
return getNamespace;
}

View File

@ -8,9 +8,11 @@ import Banner from './Banner';
import NativeExpress from './NativeExpress';
export default class Admob extends ModuleBase {
export default class AdMob extends ModuleBase {
static _NATIVE_MODULE = 'AdMob';
constructor(firebaseApp: Object, options: Object = {}) {
super(firebaseApp, options, 'AdMob', true);
super(firebaseApp, options, AdMob._NATIVE_MODULE, true);
this._initialized = false;
this._appId = null;

View File

@ -7,8 +7,9 @@ import ModuleBase from './../../utils/ModuleBase';
* @class Config
*/
export default class RemoteConfig extends ModuleBase {
static _NATIVE_MODULE = 'RemoteConfig';
constructor(firebaseApp: Object, options: Object = {}) {
super(firebaseApp, options, 'RemoteConfig');
super(firebaseApp, options, RemoteConfig._NATIVE_MODULE);
this.developerModeEnabled = false;
}