Skip to content

NPM Package for React Native implementation of Embrace SDK

License

Notifications You must be signed in to change notification settings

embrace-io/embrace-react-native-sdk

Repository files navigation

NPM - React Native Embrace

Embrace gathers the information needed to identify issues and measure performance automatically upon integration. The following React Native guide provides simple instruction on how to call the relevant functions so teams can be provided much needed additional context (logs and user info) and measure the timing of key areas of their app explicitly (moments).

For additional info please refer to the React Native Guide.

Requirements

Only an Embrace App ID and an Embrace API Token.

If you need an App ID and API Token, Go to our dashboard to create an account.

Integration

Step 1: Add Embrace React Native SDK

1.1: Add EmbraceIO's Pod to your Podfile

NPM

    npm install @embrace-io/react-native

YARN

    yarn add @embrace-io/react-native
Setup Script

The JavaScript Embrace SDK ships with a setup script to modify the files in your project to add the native dependencies. The setup scripts can be found in your node_modules folder at node_modules/@embrace-io/react-native/lib/scripts/setup

Run the setup script

node node_modules/@embrace-io/react-native/lib/scripts/setup/installAndroid.js
node node_modules/@embrace-io/react-native/lib/scripts/setup/installIos.js

You can use git to see the changes that the script made.

git diff

Step 6: Initialize Embrace SDK

Initialize method applies the necessary listener to your application. This allow Embrace to track javascript errors, check js bundle changes (if you use OTA), track js patch and react native versions.

import { initialize } from "@embrace-io/react-native";

type Props = {};
export default class App extends Component<Props> {
  componentDidMount() {
    initialize();
  }
}