From 5497b39d0ddcff10bd6f83cf749fc1b6b0f81580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20A=2E=20Myrland?= Date: Wed, 21 Sep 2022 16:43:09 +0200 Subject: [PATCH 1/2] Update reactotron recipe Based on the existing docs & [this SO post](https://stackoverflow.com/questions/72947271/how-to-use-reactotron-redux-with-easy-peasy). closes #757 --- .../docs/recipes/connecting-to-reactotron.md | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/website/docs/docs/recipes/connecting-to-reactotron.md b/website/docs/docs/recipes/connecting-to-reactotron.md index 6f3ee4060..29830f5f9 100644 --- a/website/docs/docs/recipes/connecting-to-reactotron.md +++ b/website/docs/docs/recipes/connecting-to-reactotron.md @@ -7,22 +7,17 @@ It is possible to configure Easy Peasy so to be connected to your Reactotron ins Firstly, ensure you have a Reactotron configuration similar to. ```javascript -// reactotron-config.js +// reactotron.js import Reactotron from "reactotron-react-native"; import { reactotronRedux } from "reactotron-redux"; -const reactotronConfig = { - initiate: () => { - Reactotron.configure() - .useReactNative() - .use(reactotronRedux()) - .connect(); - }, - createEnhancer: () => Reactotron.createEnhancer() -}; - -export default reactotronConfig; +const reactron = Reactotron.configure() + .useReactNative() + .use(reactotronRedux()) + .connect(); + +export default reactron; ``` Then update the manner in which you create your Easy Peasy store. @@ -36,8 +31,7 @@ import model from "./model"; let storeEnhancers = []; if (__DEV__) { - const reactotron = require("../reactotron-config").default; - reactotron.initiate(); + const reactotron = require("./reactotron").default; storeEnhancers = [...storeEnhancers, reactotron.createEnhancer()]; } @@ -46,4 +40,4 @@ const store = createStore(model, { }); export default store; -``` \ No newline at end of file +``` From 86d9640920ea6535e9364128802507c248461325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20Myrland?= Date: Tue, 25 Oct 2022 17:08:59 +0200 Subject: [PATCH 2/2] Adds solution for iOS issues in docs --- .../docs/recipes/connecting-to-reactotron.md | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/website/docs/docs/recipes/connecting-to-reactotron.md b/website/docs/docs/recipes/connecting-to-reactotron.md index 29830f5f9..1d0328cb0 100644 --- a/website/docs/docs/recipes/connecting-to-reactotron.md +++ b/website/docs/docs/recipes/connecting-to-reactotron.md @@ -1,16 +1,18 @@ # Connecting to Reactotron -[Reactotron](https://github.com/infinitered/reactotron) is a desktop app for inspecting your React JS and React Native projects. +[Reactotron](https://github.com/infinitered/reactotron) is a desktop app for +inspecting your React JS and React Native projects. -It is possible to configure Easy Peasy so to be connected to your Reactotron instance. +It is possible to configure Easy Peasy so to be connected to your Reactotron +instance. Firstly, ensure you have a Reactotron configuration similar to. ```javascript // reactotron.js -import Reactotron from "reactotron-react-native"; -import { reactotronRedux } from "reactotron-redux"; +import Reactotron from 'reactotron-react-native'; +import { reactotronRedux } from 'reactotron-redux'; const reactron = Reactotron.configure() .useReactNative() @@ -25,13 +27,19 @@ Then update the manner in which you create your Easy Peasy store. ```javascript // create-store.js -import { createStore } from "easy-peasy"; -import model from "./model"; +import { createStore } from 'easy-peasy'; +import model from './model'; + +// There might be an issue causing `setItem` not being called correctly +// for iOS devices using React Native. The solution for this is currently +// to remove the implemenation of `requestIdleCallback`. +// Read this issue for more information: https://github.com/ctrlplusb/easy-peasy/issues/599 +window.requestIdleCallback = null; let storeEnhancers = []; if (__DEV__) { - const reactotron = require("./reactotron").default; + const reactotron = require('./reactotron').default; storeEnhancers = [...storeEnhancers, reactotron.createEnhancer()]; }