Helpers for Log
that uses reactotron
and crashlytics
.
To use the component, you need to add reactotron-react-native
as a dev dependency and both @react-native-firebase/app
and @react-native-firebase/crashlytics
as dependencies to your project and follow the instruction for them.
import React from 'react';
import { View } from 'react-native';
import {
configureLog,
Button,
} from '@eslam-elmeniawy/react-native-common-components';
const MyComponent = () => {
React.useEffect(() => {
configureLog?.({
appName: '@eslam-elmeniawy/react-native-common-components',
firebaseLogLevels: ['INFO', 'LOG', 'WARN', 'ERROR'],
isLocalLogEnable: true,
});
});
const onPress = () => console.log('Log message');
return (
<View>
<Button text="Log" onPress={onPress} />
</View>
);
};
Type: ((options?: Options) => Reactotron<ReactotronReactNative> & ReactotronReactNative) | undefined
Type: string
The app name to use when configuring reactotron
.
Type: Array<'INFO' | 'LOG' | 'WARN' | 'ERROR'>
Default value: []
Log levels to add to firebase crashlytics
logs.
Type: boolean
Default value: false
Whether to enable local log or not.
Type: ClientOptions
reactotron
client options.
Type: ((client: Reactotron<ReactotronReactNative> & ReactotronReactNative) => any)[]
List of reactotron
plugin creator functions to add to add to reactotron
instance.