How to use the @react-native-firebase/app/lib/internal/NativeFirebaseError.fromEvent 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 / DatabaseSyncTree.js View on Github external
_handleErrorEvent(event) {
    // console.log('SyncTree.ERROR >>>', event);
    const { eventRegistrationKey, registrationCancellationKey } = event.registration;

    const registration = this.getRegistration(registrationCancellationKey);

    if (registration) {
      // build a new js error - we additionally attach
      // the ref as a property for easier debugging
      const error = NativeError.fromEvent(event.error, 'database');

      // forward on to users .on(successCallback, cancellationCallback <-- listener
      SharedEventEmitter.emit(registrationCancellationKey, error);

      // remove the paired event registration - if we received a cancellation
      // event then it's guaranteed that they'll be no further value events
      this.removeRegistration(eventRegistrationKey);
    }
  }
github invertase / react-native-firebase / packages / database / lib / DatabaseTransaction.js View on Github external
_handleError(event) {
    const transaction = this._getTransaction(event.id);

    if (transaction && !transaction.completed) {
      transaction.completed = true;

      try {
        // error, committed, snapshot
        const error = NativeError.fromEvent(event.body.error, 'database');
        transaction.onComplete(error, false, null);
      } finally {
        this._removeTransaction(event.id);
      }
    }
  }
github invertase / react-native-firebase / packages / firestore / lib / FirestoreDocumentReference.js View on Github external
event => {
        if (event.body.error) {
          handleError(NativeError.fromEvent(event.body.error, 'firestore'));
        } else {
          const documentSnapshot = new FirestoreDocumentSnapshot(
            this._firestore,
            event.body.snapshot,
          );
          handleSuccess(documentSnapshot);
        }
      },
    );
github invertase / react-native-firebase / packages / firestore / lib / FirestoreTransactionHandler.js View on Github external
_handleError(event) {
    const { listenerId: id, body } = event;
    const { error } = body;

    if (!this._pending[id]) {
      return;
    }

    const { meta } = this._pending[id];

    if (meta && error) {
      const errorAndStack = NativeError.fromEvent(error, 'firestore', meta.stack);
      meta.reject(errorAndStack);
    }
  }
github invertase / react-native-firebase / packages / admob / lib / ads / MobileAd.js View on Github external
_handleAdEvent(event) {
    const { type, error, data } = event.body;

    if (type === AdEventType.LOADED || type === RewardedAdEventType.LOADED) {
      this._loaded = true;
    }

    if (this._onAdEventHandler) {
      let nativeError;
      if (error) {
        nativeError = NativeError.fromEvent(error, 'admob');
      }

      this._onAdEventHandler(type, nativeError, data);
    }
  }
github invertase / react-native-firebase / packages / firestore / lib / FirestoreQuery.js View on Github external
event => {
        if (event.body.error) {
          handleError(NativeError.fromEvent(event.body.error, 'firestore'));
        } else {
          const querySnapshot = new FirestoreQuerySnapshot(
            this._firestore,
            this,
            event.body.snapshot,
          );
          handleSuccess(querySnapshot);
        }
      },
    );

@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