basic implementation of reactotron, tracks api calls and redux

to my surprise it also started tracking hive calls, it's huge thing for me
This commit is contained in:
Nouman Tahir 2021-05-18 10:26:29 +05:00
parent a10e5b3146
commit 5ad8ce3506
5 changed files with 72 additions and 2 deletions

4
App.js
View File

@ -2,4 +2,8 @@
import bugsnag from './src/config/bugsnag';
import App from './src/index';
if (__DEV__) {
import('./reactotron-config').then(() => console.log('Reactotron Configured'));
}
export default App;

View File

@ -149,6 +149,8 @@
"prettier": "^2.0.2",
"prettier-eslint": "^9.0.1",
"react-test-renderer": "16.9.0",
"reactotron-react-native": "^5.0.0",
"reactotron-redux": "^3.1.3",
"redux-devtools-extension": "^2.13.5",
"redux-logger": "^3.0.6"
},

14
reactotron-config.ts Normal file
View File

@ -0,0 +1,14 @@
import AsyncStorage from '@react-native-community/async-storage'
import Reactotron from 'reactotron-react-native'
import { reactotronRedux } from 'reactotron-redux'
const reactotron = Reactotron
.setAsyncStorageHandler(AsyncStorage) // AsyncStorage would either come from `react-native` or `@react-native-community/async-storage` depending on where you get it from
.configure({
name: "Ecency"
})
.useReactNative() // add all built-in react native plugins
.use(reactotronRedux())
.connect() // let's connect!
export default reactotron;

View File

@ -1,8 +1,9 @@
import { createStore, applyMiddleware } from 'redux';
import { createStore, applyMiddleware, compose } from 'redux';
import logger from 'redux-logger';
import thunk from 'redux-thunk';
import { persistStore, persistReducer } from 'redux-persist';
import AsyncStorage from '@react-native-community/async-storage';
import Reactotron from '../../../reactotron-config';
import reducer from '../reducers';
@ -25,7 +26,10 @@ if (process.env.NODE_ENV === 'development') {
// middleware.push(logger);
}
const store = createStore(persistedReducer, applyMiddleware(...middleware));
const store = createStore(
persistedReducer,
compose(applyMiddleware(...middleware), Reactotron.createEnhancer()),
);
const persistor = persistStore(store);

View File

@ -6353,6 +6353,11 @@ minizlib@^2.1.0:
minipass "^3.0.0"
yallist "^4.0.0"
mitt@1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/mitt/-/mitt-1.1.3.tgz#528c506238a05dce11cd914a741ea2cc332da9b8"
integrity sha512-mUDCnVNsAi+eD6qA0HkRkwYczbLHJ49z17BGe2PYRhZL4wpZUFZGJHU7/5tmvohoma+Hdn0Vh/oJTiPEmgSruA==
mixin-deep@^1.2.0:
version "1.3.2"
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566"
@ -7305,6 +7310,15 @@ qs@~6.5.2:
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
query-string@6.10.1:
version "6.10.1"
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.10.1.tgz#30b3505f6fca741d5ae541964d1b3ae9dc2a0de8"
integrity sha512-SHTUV6gDlgMXg/AQUuLpTiBtW/etZ9JT6k6RCtCyqADquApLX0Aq5oK/s5UeTUAWBG50IExjIr587GqfXRfM4A==
dependencies:
decode-uri-component "^0.2.0"
split-on-first "^1.0.0"
strict-uri-encode "^2.0.0"
query-string@^6.13.6:
version "6.14.1"
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.14.1.tgz#7ac2dca46da7f309449ba0f86b1fd28255b0c86a"
@ -7445,6 +7459,11 @@ react-native-fast-image@^8.3.2:
resolved "https://registry.yarnpkg.com/react-native-fast-image/-/react-native-fast-image-8.3.4.tgz#79edca177e30311b19d59ff335625bcbe22650d7"
integrity sha512-LpzAdjUphihUpVEBn5fEv5AILe55rHav0YiZroPZ1rumKDhAl4u2cG01ku2Pb7l8sayjTsNu7FuURAlXUUDsow==
react-native-flipper@^0.34.0:
version "0.34.0"
resolved "https://registry.yarnpkg.com/react-native-flipper/-/react-native-flipper-0.34.0.tgz#7df1f38ba5d97a9321125fe0fccbe47d99e6fa1d"
integrity sha512-48wgm29HJTOlZ0DibBsvXueEOY0EPIVL0wWKbwRfgrk86+luSEuLW3aZC50oJa95zSFb9qYShTV/6dWqh4Jamg==
react-native-gesture-handler@^1.9.0:
version "1.10.3"
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.10.3.tgz#942bbf2963bbf49fa79593600ee9d7b5dab3cfc0"
@ -7818,6 +7837,28 @@ react@16.9.0:
object-assign "^4.1.1"
prop-types "^15.6.2"
reactotron-core-client@2.8.10:
version "2.8.10"
resolved "https://registry.yarnpkg.com/reactotron-core-client/-/reactotron-core-client-2.8.10.tgz#798f2a7aa9fd7e18e7a510531a613e8ae3008eb0"
integrity sha512-SYRO4OCutJzfWMnaULUGVyETZnMDCU5ECNflXyM3Z5Gnfxp/wV6d7jYonhfxHdpU/aGb4Eg15C22myOCXSu6HQ==
reactotron-react-native@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/reactotron-react-native/-/reactotron-react-native-5.0.0.tgz#e495630927cb720940f5d8cc7d768f162b32c1a7"
integrity sha512-7nLrMkLXU9jiHymbB6oBqf8z+vww1AbDcUdMmLqX0obdIHyC8XJB0yRazWajKQC92kamkL+q2q4mH9HRSsYCEA==
dependencies:
mitt "1.1.3"
query-string "6.10.1"
reactotron-core-client "2.8.10"
rn-host-detect "1.2.0"
optionalDependencies:
react-native-flipper "^0.34.0"
reactotron-redux@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/reactotron-redux/-/reactotron-redux-3.1.3.tgz#ec61ef7a7e1dffda766e534f858f3bb854396d53"
integrity sha512-8QVEbr2R4GtFlXwSe0uK5bkuz3xRWZx8Nwi2g9e6cRbpkesTfycWVK5Oyn+wR9XOTt894WSn8CAH2TB6dVuDyg==
read-pkg-up@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be"
@ -8171,6 +8212,11 @@ rn-fetch-blob@^0.12.0:
base-64 "0.1.0"
glob "7.0.6"
rn-host-detect@1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/rn-host-detect/-/rn-host-detect-1.2.0.tgz#8b0396fc05631ec60c1cb8789e5070cdb04d0da0"
integrity sha512-btNg5kzHcjZZ7t7mvvV/4wNJ9e3MPgrWivkRgWURzXL0JJ0pwWlU4zrbmdlz3HHzHOxhBhHB4D+/dbMFfu4/4A==
rn-placeholder@^1.3.2:
version "1.3.3"
resolved "https://registry.yarnpkg.com/rn-placeholder/-/rn-placeholder-1.3.3.tgz#205067c1a2f08bcdfe09971b0c48b46afcd9c952"