How to use the @react-native-firebase/app/lib/common.promiseWithOptionalCallback 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 / database / lib / DatabaseReference.js View on Github external
set(value, onComplete) {
    if (isUndefined(value)) {
      throw new Error("firebase.database().ref().set(*) 'value' must be defined.");
    }

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

    return promiseWithOptionalCallback(this._database.native.set(this.path, { value }), onComplete);
  }
github invertase / react-native-firebase / packages / database / lib / DatabaseReference.js View on Github external
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,
      }),
      onComplete,
    );
  }
github invertase / react-native-firebase / packages / database / lib / DatabaseReference.js View on Github external
remove(onComplete) {
    if (!isUndefined(onComplete) && !isFunction(onComplete)) {
      throw new Error(
        "firebase.database().ref().remove(*) 'onComplete' must be a function if provided.",
      );
    }

    return promiseWithOptionalCallback(this._database.native.remove(this.path), onComplete);
  }
github invertase / react-native-firebase / packages / database / lib / DatabaseOnDisconnect.js View on Github external
set(value, onComplete) {
    if (isUndefined(value)) {
      throw new Error("firebase.database().ref().value(*) 'value' must be defined.");
    }

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

    return promiseWithOptionalCallback(
      this._ref._database.native.onDisconnectSet(this._ref.path, { value }),
      onComplete,
    );
  }
github invertase / react-native-firebase / packages / database / lib / DatabaseReference.js View on Github external
setPriority(priority, onComplete) {
    if (!isNumber(priority) && !isString(priority) && !isNull(priority)) {
      throw new Error(
        "firebase.database().ref().setPriority(*) 'priority' must be a number, string or null value.",
      );
    }

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

    return promiseWithOptionalCallback(
      this._database.native.setPriority(this.path, { priority }),
      onComplete,
    );
  }
github invertase / react-native-firebase / packages / database / lib / DatabaseOnDisconnect.js View on Github external
cancel(onComplete) {
    if (!isUndefined(onComplete) && !isFunction(onComplete)) {
      throw new Error(
        "firebase.database().ref().onDisconnect().cancel(*) 'onComplete' must be a function if provided.",
      );
    }

    return promiseWithOptionalCallback(
      this._ref._database.native.onDisconnectCancel(this._ref.path),
      onComplete,
    );
  }
github invertase / react-native-firebase / packages / database / lib / DatabaseOnDisconnect.js View on Github external
const keys = Object.keys(values);
    for (let i = 0; i < keys.length; i++) {
      if (!isValidPath(keys[i])) {
        throw new Error(
          'firebase.database().onDisconnect().update(*) \'values\' contains an invalid path. Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"',
        );
      }
    }

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

    return promiseWithOptionalCallback(
      this._ref._database.native.onDisconnectUpdate(this._ref.path, { values }),
      onComplete,
    );
  }
}
github invertase / react-native-firebase / packages / database / lib / DatabaseOnDisconnect.js View on Github external
throw new Error("firebase.database().ref().setWithPriority(*) 'value' must be defined.");
    }

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

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

    return promiseWithOptionalCallback(
      this._ref._database.native.onDisconnectSetWithPriority(this._ref.path, { value, priority }),
      onComplete,
    );
  }
github invertase / react-native-firebase / packages / database / lib / DatabaseReference.js View on Github external
const keys = Object.keys(values);
    for (let i = 0; i < keys.length; i++) {
      if (!isValidPath(keys[i])) {
        throw new Error(
          'firebase.database().update(*) \'values\' contains an invalid path. Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"',
        );
      }
    }

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

    return promiseWithOptionalCallback(
      this._database.native.update(this.path, { values }),
      onComplete,
    );
  }
github invertase / react-native-firebase / packages / database / lib / DatabaseOnDisconnect.js View on Github external
remove(onComplete) {
    if (!isUndefined(onComplete) && !isFunction(onComplete)) {
      throw new Error(
        "firebase.database().ref().onDisconnect().remove(*) 'onComplete' must be a function if provided.",
      );
    }

    return promiseWithOptionalCallback(
      this._ref._database.native.onDisconnectRemove(this._ref.path),
      onComplete,
    );
  }

@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