winoteam / react-router-navigation

⛵️ A complete navigation library for React Native, React DOM and React Router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Props passed down to route updated only at re-routing

art1c0 opened this issue · comments

Do you want to request a feature or report a bug
bug

What is the current behavior?
Pass props to a Route like this
<Route exact path="/" render={() => <Home {...this.props} />} />
Home component will receive updated props only at re-routing, but not when they're actually being changed.

  1. Changing the state in parent component does not affect the props of routed component.

  2. Trying to change the route will trigger the re-rendering of updated props in routed component.

  3. Using Switch and Route from 'react-router-native' free of this issue and work as expected.

What is the expected behavior?
Props should change in a routed component when they actually change, not upon re-routing.

Environment (include versions). Did this work in previous versions?

  • Device: iOS Simulator
  • OS: ...
  • React-Native (version): 0.54.2
  • React-Router-Native (version): 4.2.0
  • React-Router-Navigation (version): 1.0.0-rc.4

This should be fixed in the version v2.0.0-alpha.7. Let me know if you continue to have any problems with this !