-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReactotronConfig.js
39 lines (34 loc) · 1.05 KB
/
ReactotronConfig.js
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
import { reactotronRedux } from 'reactotron-redux';
import AsyncStorage from '@react-native-async-storage/async-storage';
import Reactotron, { networking } from 'reactotron-react-native';
import sagaPlugin from 'reactotron-redux-saga';
let reactotron;
if (__DEV__ && process.env.NODE_ENV !== 'test') {
reactotron = Reactotron.configure({
name: 'MyTestApp',
onConnect: () => Reactotron.clear(),
})
.setAsyncStorageHandler(AsyncStorage)
.useReactNative()
.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;