How to use the reactotron-react-native.createSagaMonitor function in reactotron-react-native

To help you get started, we’ve selected a few reactotron-react-native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uport-project / uport-mobile / lib / store / store.js View on Github external
import { NativeModules } from 'react-native'

let createStore = reduxCreateStore
let sagaMiddlewarePlugins

if (global.__DEV__) {
  const scriptURL = NativeModules.SourceCode.scriptURL
  const scriptHostname = scriptURL.split('://')[1].split(':')[0]

  Reactotron.configure({ name: 'uPortMobile', host: scriptHostname })
    .useReactNative()
    .use(sagaPlugin())
    .use(reactotronRedux())
    .connect()
    .clear()
  const sagaMonitor = Reactotron.createSagaMonitor()
  sagaMiddlewarePlugins = { sagaMonitor }
  createStore = Reactotron.createStore

  console.tron = Reactotron
}

// const logMiddleware = (store) => (next) => (action) => {
//   console.log(action.type)
//   return next(action)
// }
let composeEnhancers
if (typeof window !== 'undefined') {
  composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
} else {
  composeEnhancers = compose
}
github thinger-io / Mobile-App / src / config / store.js View on Github external
auth,
    devices,
    lockedAttributes,
    login,
    orientation,
    resources,
    selectedAttributes,
    selectedDevice,
    selectedResource,
    streaming,
    toast,
    userDevices,
  });

  // Saga middleware
  const sagaMonitor = Config.useReactotron ? Reactotron.createSagaMonitor() : null;
  const sagaMiddleware = createSagaMiddleware({ sagaMonitor });

  const middleware = [thunkMiddleware, vibrate, sagaMiddleware];

  const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

  // If Reactotron is enabled (default for dev), we'll create the store through Reactotron
  const createAppropriateStore = Config.useReactotron ? Reactotron.createStore : createStore;
  const store = createAppropriateStore(reducer, composeEnhancers(applyMiddleware(...middleware)));

  // Kick off root saga
  store.sagaTask = sagaMiddleware.run(rootSaga);
  const persistor = persistStore(store);

  // For purge the Store
  // persistor.purge();
github infinitered / reactotron / examples / ReactotronTester / app / redux / store.ts View on Github external
export default () => {
  Reactotron.createSagaMonitor()

  const store = createStore(
    rootReducer,
    compose(
      middleware,
      Reactotron.createEnhancer()
    )
  )
  // const store = (Reactotron as any).createStore(rootReducer, compose(middleware))

  return store
}
github RocketChat / Rocket.Chat.ReactNative / app / lib / createStore.js View on Github external
import Reactotron from 'reactotron-react-native';
import createSagaMiddleware from 'redux-saga';
import applyAppStateListener from 'redux-enhancer-react-native-appstate';

import reducers from '../reducers';
import sagas from '../sagas';

const createStore = __DEV__ ? Reactotron.createStore : reduxCreateStore;
let sagaMiddleware;
let enhancers;

if (__DEV__) {
	/* eslint-disable global-require */
	const reduxImmutableStateInvariant = require('redux-immutable-state-invariant').default();
	sagaMiddleware = createSagaMiddleware({
		sagaMonitor: Reactotron.createSagaMonitor()
	});

	enhancers = compose(
		applyAppStateListener(),
		applyMiddleware(reduxImmutableStateInvariant),
		applyMiddleware(sagaMiddleware)
	);
} else {
	sagaMiddleware = createSagaMiddleware();
	enhancers = compose(
		applyAppStateListener(),
		applyMiddleware(sagaMiddleware)
	);
}

const store = createStore(reducers, enhancers);
github squatsandsciencelabs / OpenBarbellApp / app / redux / Store.js View on Github external
export default initializeStore = () => {
    // create the store
    if (__DEV__) {
        // reactotron development mode
        const sagaMonitor = Reactotron.createSagaMonitor();
        var sagaMiddleware = createSagaMiddleware({sagaMonitor});
        const middlewares = applyMiddleware(
            thunk,
            sagaMiddleware
        );
        const enhancers = compose(middlewares, autoRehydrate());        
        var store = Reactotron.createStore(reducers, enhancers);
    } else {
        // release mode
        var sagaMiddleware = createSagaMiddleware();
        const middlewares = applyMiddleware(
            thunk,
            sagaMiddleware
        );
        const enhancers = compose(middlewares, autoRehydrate());        
        var store = createStore(reducers, enhancers);
github squatsandsciencelabs / OpenBarbellApp / app / redux / Store.js View on Github external
export default initializeStore = () => {
    // create the store
    if (__DEV__) {
        // reactotron development mode
        const sagaMonitor = Reactotron.createSagaMonitor();
        var sagaMiddleware = createSagaMiddleware({sagaMonitor});
        const middlewares = applyMiddleware(
            thunk,
            sagaMiddleware
        );
        const enhancers = compose(middlewares, autoRehydrate());        
        var store = Reactotron.createStore(reducers, enhancers);
    } else {
        // release mode
        var sagaMiddleware = createSagaMiddleware();
        const middlewares = applyMiddleware(
            thunk,
            sagaMiddleware
        );
        const enhancers = compose(middlewares, autoRehydrate());        
        var store = createStore(reducers, enhancers);
github aerian-studios / ignite-typescript-boilerplate / boilerplate / App / Reducers / CreateStore.tsx View on Github external
export default (rootReducer: Reducer, rootSaga: () => SagaIterator) => {
  /* ------------- Redux Configuration ------------- */

  const middleware = [];
  const enhancers = [];

  /* ------------- Analytics Middleware ------------- */
  if (Config.useReactotron) {
    middleware.push(ScreenTracking);
  }
  /* ------------- Saga Middleware ------------- */

  let opts = {};
  if (Config.useReactotron) {
    const sagaMonitor: Monitor = Reactotron.createSagaMonitor();
    opts = { sagaMonitor };
  }
  const sagaMiddleware = sagaMiddlewareFactory(opts);
  middleware.push(sagaMiddleware);

  /* ------------- Assemble Middleware ------------- */

  enhancers.push(applyMiddleware(...middleware));

  // if Reactotron is enabled (default for __DEV__), we'll create the store through Reactotron
  const createAppropriateStore = Config.useReactotron ? Reactotron.createStore : createStore;

  const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

  const store = createAppropriateStore(rootReducer, composeEnhancers(...enhancers));
github thiagobrez / react-native-template-pro / src / store.js View on Github external
import {createStore, applyMiddleware} from 'redux';
import Reactotron from 'reactotron-react-native';
import createSagaMiddleware from 'redux-saga';
import reducers from './reducers';
import rootSaga from './sagas';

/**
 * Reactotron linking for Redux-Saga.
 */
const sagaMonitor = Reactotron.createSagaMonitor();
const sagaMiddleware = createSagaMiddleware({sagaMonitor});

/**
 * Redux store creation.
 */
const store = Reactotron.createStore(
	reducers,
	applyMiddleware(sagaMiddleware)
);

/**
 * Starts root saga listener.
 */
sagaMiddleware.run(rootSaga);

export default store;
github Kamahl19 / react-starter / rnmobile / src / app / store / configureStore.dev.js View on Github external
export default function configureStore() {
  const sagaMiddleware = createSagaMiddleware({
    sagaMonitor: Reactotron.createSagaMonitor(),
  });

  const persistedReducer = persistReducer(
    {
      key: 'root',
      storage: AsyncStorage,
      whitelist: ['auth'],
      debug: true,
    },
    rootReducer
  );

  const store = Reactotron.createStore(
    persistedReducer,
    compose(applyMiddleware(sagaMiddleware, logger))
  );
github textileio / photos / App / Redux / configureStore.ts View on Github external
export default () => {
  const sagaMonitor = DebugConfig.useReactotron
    ? Reactotron.createSagaMonitor()
    : undefined
  const sagaMiddleware = createSagaMiddleware({ sagaMonitor })

  const createAppropriateStore = DebugConfig.useReactotron
    ? Reactotron.createStore
    : createStore
  const store = createAppropriateStore(
    persistedReducer,
    applyMiddleware(sagaMiddleware)
  )

  const bootstrappedCallback = () => store.dispatch(StartupActions.startup())
  const persistor = persistStore(store, undefined, bootstrappedCallback)

  sagaMiddleware.run(rootSaga)