0.0.9 • Published 4 years ago

@elcoach/react-native-crashlytics v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

react-native-crashlytics

A simple module for just Firebase Crashlytics; in case you still can't update your firebase setup for God-knows-what reasons you might have.
Code is heavily inspired by invertase/react-native-firebase.

Installation

Follow Crashlytic's installation instructions for iOS and Android, then install the package:

yarn

$ yarn add @elcoach/react-native-crashlytics

npm

$ npm install @elcoach/react-native-crashlytics --save

Link the package (for RN < 60.0)

$ react-native link @elcoach/react-native-crashlytics

Usage

In a starting point of your app

import RnCrashlytics, { initCrashlytics } from '@elcoach/react-native-crashlytics';

const logDetails = () => {
    // log app version
    RnCrashlytics.setValueForKey('app_version', '2.0-alpha');
    RnCrashlytics.setValueForKey('some_other_key', 'some other value');
}

const cleanUp = () => {
    console.log('we crashed pretty hard');
}

initCrashlytics(
    userId = 'unique_user_id_goes_here',
    beforeLog = logDetails,
    afterLog = cleanUp
);

To test a crash

// you can be really creative here, sky is the limit.
RnCrashlytics.crash();

Fatal crashes

By default, js errors are reported as non-fatal exceptions, while native errors are reported as fatal exceptions.
If you want to force-report all erros as fatal you can use the forceFatal flag (default – false):

initCrashlytics(userId = ..., beforeLog = ..., afterLog = ..., forceFatal = true);
0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago