# errorgap for React Native

See [index.md](./index.md) for API details and the placeholder values (`ERRORGAP_API_KEY`, `ERRORGAP_ENDPOINT`, `ERRORGAP_PROJECT_SLUG`).

SDK source: `github.com/errorgaphq/errorgap-react-native` · current version: `0.2.0`. Requires React Native 0.70+.

## Install

```sh
npm install @errorgap/react-native
```

No native modules ship in v1 — no `pod install`, no Gradle wiring. (Native crash reporting is pending; for native crashes use the platform SDKs alongside.)

## Configure

In your entry file (`index.js` / `App.tsx`):

```ts
import { Errorgap } from "@errorgap/react-native";
import { Platform } from "react-native";

Errorgap.init({
  endpoint:    "https://errorgap.example.com",
  projectSlug: "your-project",
  apiKey:      "flk_...",
  environment: __DEV__ ? "development" : "production",
  deviceInfo: {
    os_name:    Platform.OS,
    os_version: String(Platform.Version),
  },
});
```

The SDK hooks `ErrorUtils.setGlobalHandler` and unhandled promise rejections automatically.

## Trigger a test error

```tsx
<Button title="Test Errorgap" onPress={() => { throw new Error("Errorgap test error"); }} />
```

## Verify

Run the verification curl from [index.md](./index.md), then tap the button and confirm the onboarding screen advances.
