Skip to content

Commit a947c60

Browse files
committed
Reactotron dev tool added
1 parent 02f56e6 commit a947c60

5 files changed

Lines changed: 89 additions & 1 deletion

File tree

package-lock.json

Lines changed: 55 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
"react-native-svg": "^12.1.0",
3434
"react-native-zip-archive": "^5.0.2",
3535
"react-redux": "^7.2.1",
36+
"reactotron-react-native": "^5.0.0",
37+
"reactotron-redux": "^3.1.3",
38+
"reactotron-redux-saga": "^4.2.3",
3639
"redux-persist": "^6.0.0",
3740
"redux-saga": "^1.1.3"
3841
},

src/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ import Navigator from './navigation';
44
import {Provider} from 'react-redux';
55
import {store, persistor} from './redux/store';
66
import {PersistGate} from 'redux-persist/integration/react';
7+
import Reactotron from 'reactotron-react-native';
8+
9+
if (__DEV__) {
10+
import('./service/reactotron').then(() => {
11+
Reactotron.clear();
12+
console.log('Reactotron Configured!');
13+
});
14+
}
715

816
const App = () => (
917
<Provider store={store}>

src/redux/store.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@ import rootReducer from './slices/wordsSlice';
55
import createSagaMiddleware from 'redux-saga';
66
import mySaga from './sagas';
77
import thunk from 'redux-thunk';
8+
import Reactotron from 'reactotron-react-native';
9+
import reactotronConfig from '../service/reactotron';
810

911
const persistConfig = {
1012
key: 'root',
1113
storage: AsyncStorage,
1214
};
15+
const sagaMonitor = Reactotron.createSagaMonitor();
1316

1417
const persistedReducer = persistReducer(persistConfig, rootReducer);
15-
const sagaMiddleware = createSagaMiddleware();
18+
const sagaMiddleware = createSagaMiddleware({sagaMonitor});
1619

1720
let store = configureStore({
1821
reducer: persistedReducer,
1922
middleware: [sagaMiddleware, thunk],
23+
devTools: (__DEV__ && reactotronConfig.createEnhancer()) || undefined,
2024
});
2125

2226
// Redux persist

src/service/reactotron/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Reactotron from 'reactotron-react-native';
2+
import AsyncStorage from '@react-native-community/async-storage';
3+
import {reactotronRedux as reduxPlugin} from 'reactotron-redux';
4+
import sagaPlugin from 'reactotron-redux-saga';
5+
6+
if (__DEV__) {
7+
var reactotron = Reactotron.setAsyncStorageHandler(AsyncStorage)
8+
.configure()
9+
.use(reduxPlugin())
10+
.use(sagaPlugin())
11+
.useReactNative()
12+
.connect();
13+
14+
console.tron = reactotron;
15+
console.rtron = reactotron.logImportant;
16+
}
17+
18+
export default reactotron;

0 commit comments

Comments
 (0)