React native 使用redux导航,使用reactotron错误调试

React native 使用redux导航,使用reactotron错误调试,react-native,React Native,我尝试在redux的内部操作中导航,但命令NavigationActions.navigate不起作用,因此我安装了reactotron以尝试使用reactotron调试,但这会导致图像错误,下面是代码和反错误代码。请帮帮我 行动 export function* searchByID(action) { try { console.log('action', action); const response = yield call(apiGetProdutoByID, ac

我尝试在redux的内部操作中导航,但命令NavigationActions.navigate不起作用,因此我安装了reactotron以尝试使用reactotron调试,但这会导致图像错误,下面是代码和反错误代码。请帮帮我

行动

export function* searchByID(action) {
  try {
    console.log('action', action);
    const response = yield call(apiGetProdutoByID, action.idProduto);

    console.log('produto', response);

    yield put({
      type: TypesProdutos.SEARCH_BY_ID,
      produto: response.data.data.obj,
    });

    const produto = yield select(state => state.produtos);
    console.log(produto);

    **yield put(
      NavigationActions.navigate({
        routeName: action.route,
        params: {produto: produto},
      }),**
    );
  } catch (error) {
    console.log(error);
    yield put({type: TypesProdutos.FAIL});
  }
}
ReactotronConfig.js

import Reactotron from 'reactotron-react-native';
import AsyncStorage from '@react-native-community/async-storage';
import {reactotronRedux as reduxPlugin} from 'reactotron-redux';
import sagaPlugin from 'reactotron-redux-saga';

const reactotron = 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() // controls connection & communication settings
  .useReactNative() // add all built-in react native plugins
  .use(reduxPlugin())
  .use(sagaPlugin())
  .connect(); // let's connect!

export default reactotron;
index.js

if (__DEV__) {
  import('./ReactotronConfig').then(() => console.log('Reactotron Configured'));
}
import {AppRegistry} from 'react-native';
import App from './src';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);
index.js(存储)

错误:


在命令npm install并在我导出存储的文件中进行此修改后,应用程序开始工作

import {createStore, applyMiddleware, compose} from 'redux';
import createSagaMiddleware from 'redux-saga';
import rootReducer from './ducks';
import rootSaga from './sagas';
import Reactotron from 'reactotron-react-native';
import ReactotronConfig from '../../ReactotronConfig';

const sagaMonitor = Reactotron.createSagaMonitor;
const sagaMiddleware = createSagaMiddleware({sagaMonitor});

const middleware = applyMiddleware(sagaMiddleware);

const store = createStore(
  rootReducer,
  compose(
    middleware,
    ReactotronConfig.createEnhancer(),
  ),
);

sagaMiddleware.run(rootSaga);

export default store;
import {createStore, applyMiddleware, compose} from 'redux';
import createSagaMiddleware from 'redux-saga';
import rootReducer from './ducks';
import rootSaga from './sagas';
import Reactotron from 'reactotron-react-native';
import ReactotronConfig from '../../ReactotronConfig';

const sagaMonitor = Reactotron.createSagaMonitor;
const sagaMiddleware = createSagaMiddleware({sagaMonitor});

const middleware = applyMiddleware(sagaMiddleware);

const store = createStore(
  rootReducer,
  compose(
    middleware,
    ReactotronConfig.createEnhancer(),
  ),
);

sagaMiddleware.run(rootSaga);

export default store;