-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better solution to open the Menu when 3 dots are clicked in React Native #54
Comments
Hi there,
Hoping you may have experienced this and know the answer. |
@joniashton I've used a image like this and it works.
|
@sharathm89 I will rewrite this library using contexts so soon you can use only one modal overlay for each screen. |
@sharathm89 You can try out this package - https://www.npmjs.com/package/react-native-enhanced-popup-menu. It initially was based on this react-native-material-menu, but more flexible in terms of customizations. You can select base component to which you will stick menu. Then, later, at pressing dots for other components, you can compute dynamic offsets (added to base position) - this offset will change menu position to appropriate new component. const computeOffset = (left, top, width, height) => {
// left, top - are positions of component to which menu is relative
// width, height - are sizes of this component
// do any dynamic computations to offset initial position of menu
// they will be added to initial menu position
return { bottom: 30 }
}
const showMenu = () => menuRef.show(textRef.current, stickTo = Position.BOTTOM_CENTER, computeOffset = computeOffset); |
@sharathm89 hey could you please share how ur able to get the popup menu alongside each card .. im trying to implement this but the menu is always displayed on the last element of the flat list.....thanks in advance |
did you tried |
I am able to open menu when 3 dots icon is clicked for each item. But can the code be written in a better way..
Right now menu is getting created for each card item in a FlatList but ideally it would have been good to create single Menu View and dynamically associate it to some card where ever the 3 dots is clicked.
Expo Source Code Link
The text was updated successfully, but these errors were encountered: