What I've been trying is to pass a callback into a screen.
Here is an excerpt of my experimentation...
export default class Test extends React.Component {
constructor(props) {
super(props);
};
handleOnPress(data){
//How do we pass this callback to "Home" or "Sub"?
}
render() {
const Navigator = StackNavigator({
Home: {screen: Home},
Sub: {screen: Sub}
});
let data = {blah:"blah blah"};
return (<Navigator screenProps={data} />);
}
}
In this example, I can get this.props.screenProps.blah in both Home and Sub.
I assumed that being able to pass a prop would mean being able to pass a call back too, but I feel like I wasn't right.
Has anyone encountered this issue?
Any advice will be appreciated.