导航操作已调度但未导航

时间:2020-03-12 07:42:47

标签: redux react-navigation redux-saga

NavigationAction已调度,但未导航。 这仅在从redux-saga分派时发生。 我对这个问题一无所知。 你能帮我吗?

redux-saga

import {NavigationActions} from 'react-navigation';
yield put(NavigationActions.navigate({routeName: 'Test'}));

调试器 enter image description here App.tsx

    const store = configureStore();

export default class reduxApp extends Component {
  render() {
    return (
      <Provider store={store}>
        <Navigation />
      </Provider>
    );
  }
}

NavigationContainer

const App: React.SFC<Props> = () => {
  return (
    <>
      <NavigationContainer>
        <Stack.Navigator initialRouteName="Home">
           <Stack.Screen name="Home" component={Home} />
           <Stack.Screen name="Test" component={Test} />
        </Stack.Navigator>
      </NavigationContainer>
    </>
  );
};

configureStore

import {createStore, applyMiddleware} from 'redux';
import createSagaMiddleware from 'redux-saga';
import {createRootReducer, rootSaga} from './';
import {composeWithDevTools} from 'redux-devtools-extension';

export default function configureStore() {
  const sagaMiddleware = createSagaMiddleware();
  const store = createStore(
    createRootReducer(),
    composeWithDevTools(applyMiddleware(sagaMiddleware)),
  );
  sagaMiddleware.run(rootSaga);
  return store;
}

其他信息:

我不确定这是否很重要,但是redux开发工具上有多个实例...

"react-native": "0.61.5",
"react-redux": "^7.2.0",
"react-navigation": "^4.2.2",
"redux-saga": "^1.1.3",

enter image description here

0 个答案:

没有答案