react-native-sortable-grid icon indicating copy to clipboard operation
react-native-sortable-grid copied to clipboard

Delete Mode On Drag (Like iPhone Icons)

Open indivisable opened this issue 8 years ago • 3 comments

Great plugin, I am working on a feature where you can delete items like you can on iPhone home screen (close item on top left) which I replaced "delete.png" with a vector icon.

However running into some issues with the event getting dispatched multiple times. Was wondering if you had any insight.

<TouchableOpacity
                    style        = {{ flex: 1 }}
                    delayLongPress = { this.dragActivationTreshold }
                    onLongPress    = { this.activateDrag(key) }
                    onPress      = { this.handleTap(item.props) }>
                      <View style={ this._getItemWrapperStyle(key) }>
                          { item }
                      </View>
</TouchableOpacity>
 { this.state.deleteModeOn &&
 < TouchableWithoutFeedback onPress={this._onDeleteButtonPress(key)} style={{position:'absolute', top:3, left:3, backgroundColor:'transparent'}}>
                         <Icon
                        style={[ ,
                          {color:'#333', backgroundColor:'transparent'}]}
                        size={22} name={'ios-close-circle'}></Icon>
                        </TouchableWithoutFeedback>
                      }

The method

_onDeleteButtonPress = (blockIndex) => {
    alert("Deleting "+blockIndex);
    //this.setState({activeBlock: blockIndex});
    //this.deleteBlock();
  }

Instead of the _onDeleteButtonPress method only being called when I touch the X icon, it gets called multiple times (twice) on initial press of the Item itself.

nov-22-2016 01-10-19

indivisable avatar Nov 22 '16 06:11 indivisable

Hey, just wanted to say this is a great idea. I think the iPhone delete UX is a lot better and more familiar to people than the toggle delete mode and drag down this library comes with, so I'm going to try to do the same thing. 👍

booboothefool avatar Nov 25 '16 03:11 booboothefool

This library can maybe offer what you're looking for?

ollija avatar Jan 21 '17 14:01 ollija

@indivisable @booboothefool Have u end up with something function ? I want to implement a similar functionality

karims10 avatar Apr 24 '18 21:04 karims10