Deliberately crash your app. Good for testing crash reporting services.
npm install react-native-crash-tester
or
yarn add react-native-crash-tester
import CrashTester from 'react-native-crash-tester';
CrashTester.nativeCrash();
CrashTester.nativeCrash('Custom message!');
import CrashTester from 'react-native-crash-tester';
CrashTester.jsCrash();
CrashTester.jsCrash('Custom message!');
import * as React from 'react';
import { Button } from 'react-native';
import { CrashingComponent } from 'react-native-crash-tester';
import ErrorBoundary from './MyErrorBoundary';
function TestComponent() {
const [shown, setShown] = React.useState(false);
<ErrorBoundary>
<Button title="Crash" onPress={() => setShown(true)} />
{shown && <CrashingComponent />}
</ErrorBoundary>;
}
You can run the app in ./example
to see sample usage.
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT