samuel
samuel

Reputation: 23

Is there a way to pass data to other components in react-native-router-flux(Without access to Actions)

I know that I can do something like this:

Actions.routeName(someDataObject)

What if I want to add an initial props to a a component rendered by a scene at creation? At this point 'Actions' is unavailable?

Upvotes: 0

Views: 86

Answers (1)

samuel
samuel

Reputation: 23

Ah, Just realized that any props passed to the 'Scene' component are available in the component that is being rendered by that scene.

So, something like this

           <Scene
              key={route.key}
              component={route.component}
              initialProps={route.initialProps}
              title={route.title}
              hideNavBar={route.hideNavBar}
              hideDrawerButton={false}
              initial={route.initial}
            />

will mean that initialProps will be available in 'props.component'.

Upvotes: 0

Related Questions