I am currently dealing with two screens: Login and EmployeeList and didn't set initialRouteName.
I have combined two reducers: NavReducer and AuthReducer. I am receiving state.auth in LoginForm and state.nav in RouterWithNavigationState like so:
class RouterWithNavigationState extends Component{
...
<Router navigation = {addNavigationHelpers({
dispatch: this.props.dispatch,
state: this.props.navigation
})} />
...
}
const mapStateToProps = state =>
{
console.log (state.nav)
return
{
navigation: state.nav
}
}
export default connect(mapStateToProps)(RouterWithNavigationState)
However I get an error:
(1) mapStateToProps() in Connect(RouterWithNavigationState) must return a plain object. Instead received undefined.
(2) addNavigationHelpers is not a function
The log statement prints the initial state I defined in NavReducer.js like so: {index: 0, routes: Array(1)}
package.json:
"dependencies": {
"firebase": "^4.13.1",
"react": "16.3.1",
"react-native": "0.55.3",
"react-navigation": "^2.0.1",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-thunk": "^2.2.0"
},
"devDependencies": {
"babel-jest": "22.4.3",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.3",
"react-test-renderer": "16.3.1"
}
What am I missing?