React-native-router-flux: Component Props are not passed to renderNavigationBar method

Created on 24 Jun 2016  路  3Comments  路  Source: aksonov/react-native-router-flux

Version

Tell us which versions you are using:

  • react-native-router-flux v3.26.24
  • react-native v0.26

Expected behaviour

the renderNavigationBar static method on a scene component should receive the props of the component instance. E.g, the component is connected to redux store and you have access to the props of that component inside renderNavigationBar to affect the display of the NavBar

Actual behaviour

Only scene props are passed to renderNavigationBar

Steps to reproduce

  1. Create scene and give it a component which is connected to redux state
  2. Add renderNavigationBar static to the component with props argument
  3. Log out props in renderNavigationBar - No custom component props are available

Most helpful comment

i met the same situation of this method, i cannot dispatch action or update state, due to it is only a static method of component...

All 3 comments

i met the same situation of this method, i cannot dispatch action or update state, due to it is only a static method of component...

@willmcclellan @yutingjin I'm not sure whether this is a correct solution, but you could pass necessary props with Actions.refresh method:

static renderNavigationBar(props) {
  props.propName
}

componentWillMount() {
  Actions.refresh({propName: this.propName});
}

Hi,
Let's assign YourComponent.renderNavigationBar = NavigationBarComponent bellow your component class. It work ok.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moaxaca picture moaxaca  路  3Comments

tonypeng picture tonypeng  路  3Comments

fgrs picture fgrs  路  3Comments

jgibbons picture jgibbons  路  3Comments

GCour picture GCour  路  3Comments