NavigationAction已调度,但未导航。 这仅在从redux-saga分派时发生。 我对这个问题一无所知。 你能帮我吗?
redux-saga
import {NavigationActions} from 'react-navigation';
yield put(NavigationActions.navigate({routeName: 'Test'}));
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",