我正在学习React Native和Redux,我已经开始使用第三方库 - 特别是React Navigation
我已经按照Dan Parker的中级教程的教程,我仍然无法使它工作
我的应用程序的RootContainer:
<PrimaryNavigation />
...
export default connect(null, mapDispatchToProps)(RootContainer)
Run Code Online (Sandbox Code Playgroud)
PrimaryNavigation定义:
const mapStateToProps = (state) => {
return {
navigationState: state.primaryNav
}
}
class PrimaryNavigation extends React.Component {
render() {
return (
<PrimaryNav
navigation={
addNavigationHelpers({
dispatch: this.props.dispatch,
state: this.props.navigationState
})
}
/>
)
}
}
export default connect(mapStateToProps)(PrimaryNavigation)
Run Code Online (Sandbox Code Playgroud)
PrimaryNav定义:
const routeConfiguration = {
LoginScreen: {
screen: LoginScreen
},
MainContainer: {
screen: MainContainer
}
}
const PrimaryNav = StackNavigator(
routeConfiguration,
{
headerMode: 'none' …Run Code Online (Sandbox Code Playgroud)