open-index/open-npm huggingface dataset:
npm package: @justanalyticsapp/react-native
Description: JustAnalytics React Native SDK for crash reporting, network tracking, and mobile observability
Latest version: 0.1.1

# @justanalyticsapp/react-native

React Native SDK for JustAnalytics -- crash reporting, network tracking, navigation analytics, and performance monitoring.

## Installation

```bash
npm install @justanalyticsapp/react-native
```

## Quick Start

```typescript
import JustAnalytics from '@justanalyticsapp/react-native';

JustAnalytics.init({
  siteId: 'your-site-id',
  apiKey: 'ja_sk_your_api_key',
  environment: 'production',
  release: '1.0.0',
});
```

## Features

- **Crash Reporting** -- Global error handler + React ErrorBoundary
- **Network Tracking** -- Automatic fetch/XHR interception with distributed tracing
- **Navigation** -- React Navigation and Expo Router screen view tracking
- **Performance** -- App start time and screen render measurement
- **Offline Support** -- AsyncStorage-backed queue with retry

## API

### Core

- `JustAnalytics.init(options)` -- Initialize the SDK
- `JustAnalytics.captureException(error, options?)` -- Report an error
- `JustAnalytics.captureMessage(message, level?, options?)` -- Report a message
- `JustAnalytics.trackEvent(name, properties?)` -- Track a custom event
- `JustAnalytics.setUser({ id, email, username })` -- Set user context
- `JustAnalytics.setTag(key, value)` -- Set a global tag
- `JustAnalytics.flush()` -- Flush pending data
- `JustAnalytics.close()` -- Shut down the SDK

### Crash Reporting

```tsx
import { ErrorBoundary } from '@justanalyticsapp/react-native';

<ErrorBoundary fallback={<Text>Error occurred</Text>}>
  <App />
</ErrorBoundary>
```

### Navigation

```tsx
// React Navigation
const ref = createNavigationContainerRef();
<NavigationContainer
  ref={ref}
  onReady={() => JustAnalytics.recordInitialRoute(ref)}
  onStateChange={JustAnalytics.createNavigationListener(ref)}
/>

// Expo Router
JustAnalytics.trackExpoRouterNavigation(pathname);
```

### Performance

```typescript
JustAnalytics.markAppReady(); // After first render

const id = JustAnalytics.startScreenRender('HomeScreen');
// ... render completes ...
JustAnalytics.endScreenRender(id);
```

## License

MIT