# @elcoach/react-native-crashlytics

> Firebase Crashlytics React Native Package

Latest version **0.0.9** (published 2020-09-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @elcoach/react-native-crashlytics
pnpm add @elcoach/react-native-crashlytics
yarn add @elcoach/react-native-crashlytics
bun add @elcoach/react-native-crashlytics
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2020-09-30 |
| First published | 2020-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Muhammad Hashim |
| Maintainers | hossamelbery, mhashim6 |
| Keywords | react-native, firebase, crashlytics, elcoach |

## Links

- npm: https://www.npmjs.com/package/@elcoach/react-native-crashlytics
- Repository: https://github.com/ELCoach-Inc/react-native-crashlytics
- npm.io page: https://npm.io/package/@elcoach/react-native-crashlytics

## Dependencies (1)

- [stacktrace-js](https://npm.io/package/stacktrace-js.md) ^2.0.2

## Recent versions

- 0.0.9 (latest) — 2020-09-30
- 0.0.8 — 2020-09-30
- 0.0.7 — 2020-09-28
- 0.0.6 — 2020-09-27
- 0.0.5 — 2020-09-22
- 0.0.4 — 2020-09-22
- 0.0.3 — 2020-09-22
- 0.0.2 — 2020-09-20
- 0.0.1 — 2020-09-20

## README

# 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](https://github.com/invertase/react-native-firebase).
## Installation
Follow Crashlytic's installation instructions for [iOS](https://firebase.google.com/docs/crashlytics/get-started?platform=ios) and [Android](https://firebase.google.com/docs/crashlytics/get-started?platform=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
```javascript
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

```javascript
// 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):
```js
initCrashlytics(userId = ..., beforeLog = ..., afterLog = ..., forceFatal = true);
```

---
_Source: https://npm.io/package/@elcoach/react-native-crashlytics · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
