-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReactotronConfig.js
More file actions
40 lines (35 loc) · 1.15 KB
/
ReactotronConfig.js
File metadata and controls
40 lines (35 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import Reactotron, { networking } from 'reactotron-react-native';
import { reactotronRedux } from 'reactotron-redux';
import sagaPlugin from 'reactotron-redux-saga';
import AsyncStorage from '@react-native-async-storage/async-storage';
let reactotron;
if (__DEV__ && process.env.NODE_ENV !== 'test') {
reactotron = Reactotron.configure({
name: 'FeaturesManager',
onConnect: () => Reactotron.clear(),
})
.setAsyncStorageHandler(AsyncStorage)
// Disable logging to console since we are using a different logger for that.
.useReactNative({ log: false })
.use(reactotronRedux())
.use(networking())
.use(sagaPlugin());
reactotron.onCustomCommand({
title: 'ShowAsyncStorage',
description: 'Show values in Async Storage',
command: 'dumpAsyncStorage',
handler: () => {
AsyncStorage.getAllKeys().then(keys => {
AsyncStorage.multiGet(keys).then(data => {
data.forEach((kvPair, index) => {
Reactotron.log(
`AsyncStorage[${index}] = ${kvPair[0]}: ${kvPair[1]}`,
);
});
});
});
},
});
reactotron.connect();
}
export default reactotron;