SDK API reference
Full reference of the methods exposed by @pionne/react-native v0.3.0+.
Pionne.init(options)
Section titled “Pionne.init(options)”Initializes the SDK. Call once, at app startup.
import { Pionne } from '@pionne/react-native';
Pionne.init({ token: 'pio_live_...', release: '1.0.0', environment: 'production', tags: { tier: 'pro' }, sampleRate: 1, scrubPii: true, captureScreenshot: false, breadcrumbs: true,});PionneOptions
Section titled “PionneOptions”| Field | Type | Default | Description |
|---|---|---|---|
token | string | — | Required. Project token pio_live_... |
release | string? | auto | Release version, defaults to expo-application |
environment | string? | 'production' | production, development, staging… |
tags | Record<string, string | number | boolean>? | {} | Tags added to every event |
sampleRate | number? | 1 | Between 0 and 1, fraction of events sent |
scrubPii | boolean | Array<{re: RegExp, replace: string}>? | true | See PII |
captureScreenshot | boolean? | false | See Screenshots |
screenshotQuality | number? | 0.5 | JPG quality 0..1 |
breadcrumbs | boolean | { console?: boolean; fetch?: boolean }? | true | See Breadcrumbs |
beforeSend | (event) => event | null | — | Filter/transform hook |
enabled | boolean? | true | Fully disables sending if false |
enableInDev | boolean? | true | Set to false to no-op the SDK in __DEV__ (Metro / Expo Go). Recommended to keep your prod dashboard clean. See React Native SDK — Skip in dev. |
apiUrl | string? | 'https://api.pionne.app' | Override for self-host |
sendGeography | boolean? | false | Opt-in: IP geolocation (city/region/country) attached to every event under contexts.geo. See React Native SDK — Geography. |
geographyEndpoint | string? | 'https://ipapi.co/json/' | URL of the IP→geo lookup if you want a custom provider. |
Pionne.captureException(err, extra?)
Section titled “Pionne.captureException(err, extra?)”Captures an error explicitly. Returns void.
try { await fetchUser();} catch (err) { Pionne.captureException(err, { userId: 42, screen: 'Profile' });}Pionne.captureMessage(msg, extra?)
Section titled “Pionne.captureMessage(msg, extra?)”Sends a level: 'info' event (or customizable via extra.level).
Pionne.captureMessage('Cart abandoned', { items: 3, level: 'warning' });Pionne.setUser(idAnon)
Section titled “Pionne.setUser(idAnon)”Associates an anonymous identifier with all subsequent events. Never sends an email/name.
Pionne.setUser('user_a8f2c1');To reset: Pionne.setUser(null).
Pionne.setTags(tags)
Section titled “Pionne.setTags(tags)”Merges global tags.
Pionne.setTags({ ab_test: 'variant_b', plan: 'pro' });Pionne.setEnabled(bool)
Section titled “Pionne.setEnabled(bool)”Enables/disables sending at runtime (handy for a GDPR consent banner).
Pionne.setEnabled(false); // no event sent anymorePionne.addBreadcrumb(crumb)
Section titled “Pionne.addBreadcrumb(crumb)”Adds a manual breadcrumb. See Breadcrumbs.
Pionne.addBreadcrumb({ category: 'navigation', message: 'Navigated to Checkout', data: { from: 'Cart' },});Pionne.wrap(fn, tags?)
Section titled “Pionne.wrap(fn, tags?)”Wraps a function (sync or async) with a try/catch. The error is captured then re-thrown.
const safeSubmit = Pionne.wrap(async (form) => { await api.submit(form);}, { feature: 'checkout' });Pionne.setRootRef(ref)
Section titled “Pionne.setRootRef(ref)”Sets the root ref for screenshot capture.
const rootRef = useRef(null);useEffect(() => Pionne.setRootRef(rootRef), []);
return <View ref={rootRef} style={{ flex: 1 }}>...</View>;<PionneErrorBoundary>
Section titled “<PionneErrorBoundary>”React Error Boundary component. See Error Boundary.
Type PionneEvent
Section titled “Type PionneEvent”Shape of the payload sent to /api/ingest (summary):
type PionneEvent = { exception_type: string; message: string; stack: string | null; level: 'fatal' | 'error' | 'warning' | 'info'; release?: string; environment?: string; tags?: Record<string, unknown>; user?: { id?: string }; contexts?: { device?: object; app?: object; os?: object }; mechanism?: { type: string; handled: boolean }; breadcrumbs?: Array<{ category: string; message: string; ts: number; data?: object }>; screenshot?: string; // base64 JPG extra?: Record<string, unknown>;};