The heart of my problem is that when I have this in my navigationOptions:
static navigationOptions = ({ navigation }) => {
console.log(navigation)
console.log(navigation.state)
}
The first 'console.log' statement returns the navigation object complete with "navigation.state.params" containing the params that I have passed into it.
However, the second 'console.log' returns the 'navigation.state' object but for some reason the 'params' are undefined.
Here is how I am setting the navigation params (from redux):
function mapStateToProps(state, props) {
let sum = 0
for (let product in state.cart) {
sum += state.cart[product]
}
return props.navigation.state = {params: {cartSum: sum}}
}
And my developer environment:
node 6.10.1
react-native 0.46.4
redux 3.7.1
react-redux 5.0.5
react-navigation 1.0.0-beta.11