react-navigation / redux-helpers

Redux middleware and utils for React Navigation
Other
296 stars 43 forks source link

undefined is not an object #66

Closed vitorcamachoo closed 5 years ago

vitorcamachoo commented 6 years ago

After upgrading react-navigation to his latest version (2.18.0 => 3.0.2), I get the following error when navigating back from a tab router.

screenshot 2018-11-28 at 15 40 10

Ashoat commented 6 years ago

Have you tried updating this package to the latest version?

vitorcamachoo commented 6 years ago

Have you tried updating this package to the latest version?

Yes, i'm using 2.0.8

Ashoat commented 6 years ago

I'm not able to repro this running react-navigation@3.0.2 and react-navigation-redux-helpers@2.0.8. Navigating back from a TabRouter should move you to the default route.

I can investigate further if you can provide an MCVE that reproduces the issue, in the form of an Expo Snack or a react-native init'd repo hosted on GitHub.

vitorcamachoo commented 6 years ago

I think I may discover the reason. When I pass screenProps with some props (i.e. intl, etc..) the error is being triggered, but if I remove screenProps from the navigator, the navigation works as expected

// not working
const App = reduxifyNavigator(RootNavigator)
const mapStateToProps = ({ nav }) => ({
  state: nav,
  screenProps: {
    intl: {
      formatMessage: () => {},
    },
  },
})

export default connect(mapStateToProps)(App)
// working
const App = reduxifyNavigator(RootNavigator)
const mapStateToProps = ({ nav }) => ({
  state: nav,
})

export default connect(mapStateToProps)(App)
Ashoat commented 6 years ago

Does this issue occur if you're not using react-navigation-redux-helpers and instead just using react-navigation directly?

Again - if you'd like me to investigate I'll need an MCVE.