react-native-error-manager

Will look for errors in react native application and it automatically report it to the developers using react native santry

Usage no npm install needed!

<script type="module">
  import reactNativeErrorManager from 'https://cdn.skypack.dev/react-native-error-manager';
</script>

README

React Native Error Manager

This simple and very lightweight library will help to show users a error screen while any error happen in a production build.

Usage

import React from 'react'
import MyComponent from '../MyComponent'
import ErrorBoundary from 'react-native-error-manager'

export const Home = () => {
    return(
        <ErrorBoundary>
            <MyComponent />
        </ErrorBoundary>
    )
}

Custom error component

import React from 'react'
import {View, Text} from 'react-native'
import MyComponent from '../MyComponent'
import ErrorBoundary from 'react-native-error-manager'

export const Home = () => {

    const ErrorComponent = () => (
        <View style={{justifyContent:'center', alignItems: 'center', flex:1, backgroundColor: 'red'}}>
            <Text style={{fontSize: 30, color: '#fff', textAlign: 'center'}}>Hello this is error</Text>
        </View>
    )

    return(
        <ErrorBoundary component={<ErrorComponent />}>
            <MyComponent />
        </ErrorBoundary>
    )
}

Way to see the error

Sentry can be used for logging error with all the environments link - https://docs.sentry.io/platforms/react-native/

  • npm install --save @sentry/react-native
  • npx @sentry/wizard -i reactNative -p ios android
  • cd ios
  • pod install