Reputation: 236
I am using react native pop up menu https://github.com/instea/react-native-popup-menu not found how to close already opened menu if user clicked on another from list view.
If I am using "opened" object with setState like https://stackoverflow.com/a/42781164/3671295 it will open my all pop up because pop up menu is in list view.
After this I tried to use react native "ref" like
constructor(props, ctx) {
super(props, ctx);
this.myRef = React.createRef();
}
<Menu renderer={renderers.SlideInMenu} ref={(Menu) => { this.myRef = Menu; }} opened={false}>
<MenuTrigger onPress={() => this.resetMenu(item.id)}>
In above code I tried to set "opened" attribute value by getting it by "ref" but can't get success . Can any buddy guide me how to use pop up menu in list view where opening on new pop up already opened pop up will close.
Also I tried https://github.com/instea/react-native-popup-menu/blob/master/examples/MenuMethodsExample.js but its also not working in list view.
Upvotes: 0
Views: 608