How to pass a parameter in a response natural navigator?

I tried the React Native Navigator example:

const StudentStackNav = StackNavigator({
  Home: {
     screen: StudentLogin,
    }
});

      

How do I pass the StudentStackNav parameter and pass it to StudentLogin?

I've tried <StudentStackNav name='Lucy'>

but this.props.name

not available in Home

.

+3


source to share


1 answer


Regular props in the navigator component can be used to customize the navigator.

To send arbitrary props to screens, you must use screenProps

.

For example:



<StudentStackNav screenProps={{ name: 'Lucy' }}/>

      

Which will be available StudentLogin

as this.props.screenProps

.

screenProps

documented on this page

+8


source







All Articles