AllStak React Native SDK for JavaScript errors, native crashes, logs, breadcrumbs, HTTP telemetry, navigation breadcrumbs, and source maps.
Install
npm install @allstak/react-native
Peer requirements:
| Peer | Version |
|---|---|
react | >=16.8.0 |
react-native | >=0.70 |
Setup
Initialize the SDK as early as possible in your app entry file:
import * as AllStak from '@allstak/react-native';
import App from './App';
AllStak.init({
apiKey: process.env.EXPO_PUBLIC_ALLSTAK_API_KEY,
environment: process.env.NODE_ENV ?? 'production',
release: process.env.EXPO_PUBLIC_RELEASE,
tracesSampleRate: 1.0,
enableLogs: true,
});
export default AllStak.wrap(App);
Provider setup
import { AllStakProvider } from '@allstak/react-native';
export default function Root() {
return (
<AllStakProvider
apiKey={process.env.EXPO_PUBLIC_ALLSTAK_API_KEY}
environment="production"
release={process.env.EXPO_PUBLIC_RELEASE}
>
<App />
</AllStakProvider>
);
}
Metro source maps
const { withAllStakConfig } = require('@allstak/react-native/metro');
module.exports = withAllStakConfig({
resolver: {},
transformer: {},
});
Expo plugin
{
"expo": {
"plugins": ["@allstak/react-native"]
}
}
Useful API
AllStak.captureException(new Error('checkout failed'));
AllStak.captureMessage('cart opened', 'info');
AllStak.logger.warn('payment retry');
AllStak.setUser({ id: 'user_123', email: '[email protected]' });
await AllStak.flush();
Privacy
Use privacy components around sensitive UI so screenshots and replay metadata stay safe:
import { AllStakPrivacyView } from '@allstak/react-native';
<AllStakPrivacyView>
<CreditCardForm />
</AllStakPrivacyView>
Troubleshooting
- No events: confirm the API key is available in the mobile runtime.
- Native crashes missing: rebuild the native app after adding the package or Expo plugin.
- Source maps missing: keep runtime
releasealigned with the uploaded build release.
Contributing and Support
- Report bugs with the GitHub bug report template: https://github.com/AllStak/allstak-react-native/issues/new/choose
- Open pull requests using the checklist in CONTRIBUTING.md.
- Report security vulnerabilities privately through SECURITY.md.
License
MIT