React Native SDK
Bug reporting your testers don’t have to learn.
Add a Report button to your React Native app. Testers write one sentence; the screenshot, network requests, console logs and device details go to your board automatically.
Install
npm install @astratest/react-native react-native-view-shot # or yarn add @astratest/react-native react-native-view-shot # or with Expo npx expo install @astratest/react-native react-native-view-shot
Start the SDK
Call start once before your app renders, with your project’s test key from SDK setup in Astra Test.
import { AstraTest, AstraTestProvider } from "@astratest/react-native";
// In test builds only
if (__DEV__ || process.env.EXPO_PUBLIC_TEST_BUILD === "1") {
AstraTest.start("pk_test_…", {
appVersion: "1.4.0",
build: "214",
});
}Wrap your app
AstraTestProvider adds the Report button and the report sheet.
export default function App() {
return (
<AstraTestProvider>
<Navigation />
</AstraTestProvider>
);
}Identify the tester
Call identify after sign-in completes, so reports show who sent them.
AstraTest.identify({
email: user.email,
name: user.name,
});Set the screen name
In your React Navigation state listener, so each report says which screen the tester was on.
<NavigationContainer
onStateChange={(state) => {
const route = /* your current route logic */;
AstraTest.setScreen(route.name);
}}
>
…
</NavigationContainer>Keep private data out
Password fields are always hidden. Wrap anything else private in <AstraPrivate>.
import { AstraPrivate } from "@astratest/react-native";
<AstraPrivate>
<Text>{user.healthRecord}</Text>
</AstraPrivate>What goes with every report
Screenshot captureUses react-native-view-shot to capture what the tester sees. Password fields and views wrapped in <AstraPrivate> are blacked out.
Network recordingEvery fetch and XMLHttpRequest is logged: method, URL, status and timing. Your own API calls, not Astra Test's.
Console and errorsconsole.log, warn, error and uncaught exceptions are captured. The last 60 lines go with the report.
Device and buildPlatform, OS version, React Native version, screen size, locale, your app version and build number.
Screen nameCall setScreen from your navigation listener so reports say which screen the tester was on.
Works with ExpoInstall with npx expo install. The SDK is pure JavaScript — no native modules except the optional react-native-view-shot.
API reference
| Method | Description |
|---|---|
| AstraTest.start(key, options?) | Starts the SDK. Call once, before your app renders. |
| AstraTest.identify({ id?, email?, name? }) | Says who is testing. |
| AstraTest.setScreen(name) | Sets the current screen name for reports. |
| AstraTest.setTestCase(ref) | Sets the test case being run, e.g. "UAT-02". |
| AstraTest.log(message, level?) | Adds a line to the report log. |
| AstraTest.showReport() | Opens the report sheet programmatically. |
| AstraTest.send(description) | Sends a report without the sheet. |
| <AstraTestProvider> | Wraps your app. Adds the report button and sheet. |
| <AstraPrivate> | Blacks out its children in screenshots. |
Start options
| Option | Default | Description |
|---|---|---|
| appVersion | — | Your app version, e.g. "1.4.0". Creates the build in Builds. |
| build | — | Your build number, e.g. "214". |
| showButton | true for test keys | Show the floating Report button. |
| captureNetwork | true | Record fetch / XMLHttpRequest calls. |
| captureLogs | true | Attach console output and uncaught errors. |
Free for your first year during early access. You bring your own coding agent.