react-native-draggable
react-native-draggable copied to clipboard
Adding context menu per draggable element
I am trying to add a context menu to a draggable element, but it won't show the draggable image anymore.
I am using: react-native-popup-menu and the following code:
<Menu
opened={contextMenuOpen}
onBackdropPress={() => setConextMenuOpen(false)}
button={
<TouchableOpacity onPress={() => setConextMenuOpen(true)}>
<Draggable key={i} x={100} y={50} renderSize={80} imageSource={item.img} />
</TouchableOpacity>
}>
<MenuTrigger/>
<MenuOptions>
<MenuOption onSelect={() => alert(`Delete`)} >
<Text style={{color: 'red'}}>Delete</Text>
</MenuOption>
</MenuOptions>
</Menu>
Can anybody help or is it possible to add context menu to the draggable element by option (build in).
Cheers
Not sure if that'll work, but you should probably be passing in the menu to the draggable instead of the draggable to the menu.
<Draggable>
<Menu>....</Menu>
</Draggable>
Thanks for your reply, unfortunately not working, draggable image is still not showing.
Can you reproduce this in a snack
This is the snack I created: https://snack.expo.io/lP0ZgHbUo
Any idea?