react-native-draggable icon indicating copy to clipboard operation
react-native-draggable copied to clipboard

Adding context menu per draggable element

Open udarts opened this issue 5 years ago • 5 comments

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

udarts avatar Aug 25 '20 18:08 udarts

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>

baconcheese113 avatar Aug 25 '20 19:08 baconcheese113

Thanks for your reply, unfortunately not working, draggable image is still not showing.

udarts avatar Aug 25 '20 20:08 udarts

Can you reproduce this in a snack

baconcheese113 avatar Aug 26 '20 16:08 baconcheese113

This is the snack I created: https://snack.expo.io/lP0ZgHbUo

udarts avatar Aug 26 '20 20:08 udarts

Any idea?

udarts avatar Aug 30 '20 16:08 udarts