How to use the @react-native-firebase/app/lib/common.isNull function in @react-native-firebase/app

To help you get started, we’ve selected a few @react-native-firebase/app examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github invertase / react-native-firebase / packages / perf / lib / HttpMetric.js View on Github external
} else {
      // eslint-disable-next-line no-console
      console.warn(
        `Warning: A firebase.perf.HttpMetric (${this._httpMethod}: ${
          this._url
        }) failed to provide a httpResponseCode; this metric will not be visible on the Firebase console.`,
      );
    }

    if (!isNull(this._requestPayloadSize)) {
      metricData.requestPayloadSize = this._requestPayloadSize;
    }
    if (!isNull(this._responsePayloadSize)) {
      metricData.responsePayloadSize = this._responsePayloadSize;
    }
    if (!isNull(this._responseContentType)) {
      metricData.responseContentType = this._responseContentType;
    }

    return this.native.stopHttpMetric(this._id, metricData);
  }
}
github invertase / react-native-firebase / packages / storage / lib / utils.js View on Github external
}

  const metadataEntries = Object.entries(metadata);

  for (let i = 0; i < metadataEntries.length; i++) {
    const [key, value] = metadataEntries[i];
    // validate keys
    if (!SETTABLE_FIELDS.includes(key)) {
      throw new Error(
        `firebase.storage.SettableMetadata unknown property '${key}' provided for metadata.`,
      );
    }

    // validate values
    if (key !== 'customMetadata') {
      if (!isString(value) && !isNull(value)) {
        throw new Error(
          `firebase.storage.SettableMetadata invalid property '${key}' should be a string or null value.`,
        );
      }
    } else if (!isObject(value)) {
      throw new Error(
        'firebase.storage.SettableMetadata.customMetadata must be an object of keys and string values.',
      );
    }
  }

  return metadata;
}
github invertase / react-native-firebase / packages / database / lib / DatabaseReference.js View on Github external
push(value, onComplete) {
    if (!isUndefined(onComplete) && !isFunction(onComplete)) {
      throw new Error(
        "firebase.database().ref().push(_, *) 'onComplete' must be a function if provided.",
      );
    }

    const id = generateDatabaseId(this._database._serverTimeOffset);

    if (isUndefined(value) || isNull(value)) {
      return new DatabaseThenableReference(
        this._database,
        pathChild(this.path, id),
        Promise.resolve(this.child(id)),
      );
    }

    const pushRef = this.child(id);

    const promise = pushRef.set(value, onComplete).then(() => pushRef);

    // Prevent unhandled promise rejection if onComplete is passed
    if (onComplete) {
      promise.catch(() => {});
    }
github invertase / react-native-firebase / packages / database / lib / DatabaseReference.js View on Github external
setWithPriority(newVal, newPriority, onComplete) {
    if (isUndefined(newVal)) {
      throw new Error("firebase.database().ref().setWithPriority(*) 'newVal' must be defined.");
    }

    if (!isNumber(newPriority) && !isString(newPriority) && !isNull(newPriority)) {
      throw new Error(
        "firebase.database().ref().setWithPriority(_, *) 'newPriority' must be a number, string or null value.",
      );
    }

    if (!isUndefined(onComplete) && !isFunction(onComplete)) {
      throw new Error(
        "firebase.database().ref().setWithPriority(_, _, *) 'onComplete' must be a function if provided.",
      );
    }

    return promiseWithOptionalCallback(
      this._database.native.setWithPriority(this.path, {
        value: newVal,
        priority: newPriority,
      }),
github invertase / react-native-firebase / packages / analytics / lib / index.js View on Github external
setUserProperties(properties) {
    if (!isObject(properties)) {
      throw new Error(
        "firebase.analytics().setUserProperties(*) 'properties' expected an object of key/value pairs.",
      );
    }

    const entries = Object.entries(properties);
    for (let i = 0; i < entries.length; i++) {
      const [key, value] = entries[i];
      if (!isNull(value) && !isString(value)) {
        throw new Error(
          `firebase.analytics().setUserProperties(*) 'properties' value for parameter '${key}' is invalid, expected a string.`,
        );
      }
    }

    return this.native.setUserProperties(properties);
  }
github invertase / react-native-firebase / packages / app / lib / internal / registry / app.js View on Github external
export function initializeApp(options = {}, configOrName) {
  let appConfig = configOrName;

  if (!isObject(configOrName) || isNull(configOrName)) {
    appConfig = {
      name: configOrName,
      automaticResourceManagement: false,
      automaticDataCollectionEnabled: true,
    };
  }

  if (isUndefined(appConfig.name)) {
    appConfig.name = DEFAULT_APP_NAME;
  }

  const { name } = appConfig;

  if (!name || !isString(name)) {
    return Promise.reject(new Error(`Illegal App name: '${name}'`));
  }
github invertase / react-native-firebase / packages / analytics / lib / index.js View on Github external
setUserId(id) {
    if (!isNull(id) && !isString(id)) {
      throw new Error("firebase.analytics().setUserId(*) 'id' expected a string value.");
    }

    return this.native.setUserId(id);
  }
github invertase / react-native-firebase / packages / firestore / lib / utils / serialize.js View on Github external
export function generateNativeData(value) {
  if (Number.isNaN(value)) {
    return getTypeMapInt('nan');
  }

  if (value === Number.NEGATIVE_INFINITY) {
    return getTypeMapInt('-infinity');
  }

  if (value === Number.POSITIVE_INFINITY) {
    return getTypeMapInt('infinity');
  }

  if (isNull(value) || isUndefined(value)) {
    return getTypeMapInt('null');
  }

  if (value === DOCUMENT_ID) {
    return getTypeMapInt('documentid');
  }

  if (isBoolean(value)) {
    if (value === true) {
      return getTypeMapInt('booleanTrue');
    }
    return getTypeMapInt('booleanFalse');
  }

  if (isNumber(value)) {
    return getTypeMapInt('number', value);

@react-native-firebase/app

A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Sto

Apache-2.0
Latest version published 1 day ago

Package Health Score

98 / 100
Full package analysis