Home

Awesome

react-native-exceptions-manager

GitHub license NPM version Dependency Status Downloads

React-Native Crash Reporter In Release Version(Do not trigger native crash).

Linking

Android

include ':react-native-exceptions-manager'
project(':react-native-exceptions-manager').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-exceptions-manager/android/app')
compile project(':react-native-exceptions-manager')
import com.richardcao.exceptionsmanager.react.ExceptionsManager;
...

@Override
protected List<ReactPackage> getPackages() {
    List<ReactPackage> packages = Arrays.asList(
            new MainReactPackage(),
            ...);
    ArrayList<ReactPackage> packageList = new ArrayList<>(packages);
    if (!BuildConfig.DEBUG) {
        packageList.add(new ExceptionsManager());
    }
    return packageList;
}
public class ReactNativeJSCrashReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals("com.richardcao.android.REACT_NATIVE_CRASH_REPORT_ACTION")) {
            Throwable js = (Throwable) intent.getSerializableExtra("JavascriptException");
            ...(handler or report js crash operate)
            Throwable e = (Throwable) intent.getSerializableExtra("Exception");
            ...(handler or report native crash operate)
        }
    }
}
<application
    android:name=".MainApplication"
    android:allowBackup="true"
    ...>
    ...
    <receiver android:name=".ReactNativeJSCrashReceiver">
        <intent-filter>
            <action android:name="com.richardcao.android.REACT_NATIVE_CRASH_REPORT_ACTION" />
        </intent-filter>
    </receiver>
</application>

iOS

//TODO

Who Use It

MIT Licensed