I have a custom component 'MenuButton' in my RNNv2 topbar. I want openMenu() to run when this button is clicked, but this doesn't happen. My typescript linting tells me Property openMenu does not exist on typeof Home
. Why is this?
class Home extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
Navigation.events().bindComponent(this);
}
closeMenu = () => {
this._drawer.close();
};
openMenu = () => {
this._drawer.open();
};
static options(passProps) {
return {
topBar: {
rightButtons: [
{
component: {
name: 'MenuButton',
passProps: {
onClick: () => this.openMenu(),
},
},
},
],
},
};
}
render() {
return (
...
);
}
}
Reference I got my passProps
code from: https://github.com/wix/react-native-navigation/issues/3648