I have the following code in which HomeTab
contains a NavigatorIOS
. I'm passing HomeScreen
as the component for the navigator.
I have some events happening on a parent component that contains HomeTab
and would like to pass them to HomeScreen
. I am able to get the to HomeTab
. How can I set the props or state for the component and preferably, I'd like to be able to call a function on it. Any clue?
class HomeTab extends React.Component {
constructor() {
super()
this.state = {}
}
render() {
return (
<NavigatorIOS style={styles.container}
initialRoute={{
title: 'Home',
component: HomeScreen,
passProps: {}
}}
/>
)
}
}
You can simply pass them through that passProps object there.
I think you might be missing the other piece in your HomeScreen component.
Then in your root view you would do
N.B. that if you provide the isRequired that your code will slam to a halt if you don't provide it when you display/push HomeScreen.