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

82 Views Asked by At

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?

1

There are 1 best solutions below

1
samuel On

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'.