[skip ci] docs

This commit is contained in:
ehesp
2019-04-18 15:39:57 +01:00
parent 3ce7c6c4c3
commit da0a88584b
4 changed files with 171 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
---
title: Android Setup
description: Manually integrate Crashlytics into your Android application.
---
# Android Setup
> The following steps are only required if your environment does not have access to React Native
auto-linking.
## TODO

53
docs/crashlytics/index.md Normal file
View File

@@ -0,0 +1,53 @@
---
title: Crashlytics
description: Firebase Crashlytics is a lightweight, realtime crash reporter that helps you track, prioritize, and fix stability issues that erode your app quality.
---
# Crashlytics
Firebase Crashlytics is a lightweight, realtime crash reporter that helps you track, prioritize, and fix stability issues that erode your app quality.
React Native Firebase provides automatic crash reporting for both native and JavaScript errors, including unhandled promise rejections.
The JavaScript API also allows for full custom crash reporting and supports sending additional attributes to help debug crashes within your
application.
<Youtube id="k_mdNRZzd30" />
## Getting Started
<Grid>
<Block
icon="build"
color="#ffc107"
title="Quick Start"
to="/{{ version }}/crashlytics/quick-start"
>
Install & start capturing any errors your application throws.
</Block>
<Block
icon="school"
color="#4CAF50"
title="Guides"
to="/guides?tag=crashlytics"
>
Ensuring crash reports contain the right information to help you debug and fix the issue is crtical to providing
a stable application. Our guides cover tips and tricks for integrating Crashlytics sucessfully.
</Block>
<Block
icon="layers"
color="#03A9F4"
title="Reference"
to="/{{ version }}/crashlytics/reference"
>
The API reference covers every aspect to successfully integrate your application with
Crashlyics.
</Block>
</Grid>
## Learn more
Our documentation is a great place to start, however if you're looking for more help or want to help others,
check out the resources below:
- [Stack Overflow](https://stackoverflow.com/questions/tagged/react-native-firebase-crashlytics)
- [Github Issues](https://github.com/invertase/react-native-firebase/issues?utf8=%E2%9C%93&q=is%3Aissue+sort%3Aupdated-desc+label%3Acrashlytics+)
- [Firebase Documentation](https://firebase.google.com/docs/functions?utm_source=invertase&utm_medium=react-native-firebase&utm_campaign=crashlytics)

11
docs/crashlytics/ios.md Normal file
View File

@@ -0,0 +1,11 @@
---
title: iOS Setup
description: Manually integrate Crashlytics into your iOS application.
---
# iOS Setup
> The following steps are only required if your environment does not have access to React Native
auto-linking.
## TODO

View File

@@ -0,0 +1,96 @@
---
title: Quick Start
description: Get to grips with the basics of Crashlytics in React Native Firebase
---
# Crashlytics Quick Start
## Installation
Install this module with Yarn:
```bash
yarn add @react-native-firebase/crashlytics
```
> Integrating manually and not via React Native auto-linking? Check the setup instructions for <Anchor version group href="/android">Android</Anchor> & <Anchor version group href="/ios">iOS</Anchor>.
## Module usage
The Crashlytics package will automatically report on any fatal application crash. Both native and JavaScript
crashes along with unhandled promise rejections are captured with full stack traces.
The package provides a JavaScript API to create your own crash reports and/or send additional information
with crash reports to the Firebase console for a better debugging experience.
Once installed, import the Crashlytics package into your project:
```js
import crashlytics from '@react-native-firebase/crashlytics';
```
The package also provides access to the firebase instance:
```js
import { firebase } from '@react-native-firebase/crashlytics';
```
### Testing crashes
The Crashlytics package provides a `crash` method which is provided to ensure crash reports are correctly
being sent to the Firebase console and can be used with your own test suite. Any `log` methods called before
sending a crash report and sent with the crash report.
```js
import crashlytics from '@react-native-firebase/crashlytics';
function forceCrash() {
crashlytics.log('Testing crash');
crashlytics.crash();
}
```
### Handling non-fatal crashes
Crashlytics supports sending JavaScript stack traces to the Firebase console. This can be used in any situations
where an error occurs but is caught by your own code as a bailout method. To
send a stack trace, pass a [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
to the `recordError` method.
```js
import crashlytics from '@react-native-firebase/crashlytics';
function sendReport() {
crashlytics().recordError(
new Error(
'Error with a stack trace'
)
);
}
```
### Additional crash attributes
It is possible to provide additional attributes which are sent with crash reports. This helps with debugging and
localising the error. To set additional attributes call the `set*` methods.
```js
import crashlytics from '@react-native-firebase/crashlytics';
async function onSignIn(user) {
await Promise.all([
crashlytics().setUserId(user.uid),
crashlytics().setUserName(user.username),
crashlytics().setUserEmail(user.email),
crashlytics().setAttribute('credits', user.credits),
]);
crashlytics.crash();
}
```
### Disabling Crashlytics
To disable Crashlytics, set the `<VALUE>` to `false` in the `firebase.json` file.
To learn more, view the <Anchor version group="app" href="/firebase-json">App documentation</Anchor>.