react-native-sortable-grid
react-native-sortable-grid copied to clipboard
Delete Mode On Drag (Like iPhone Icons)
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.
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. 👍
This library can maybe offer what you're looking for?
@indivisable @booboothefool Have u end up with something function ? I want to implement a similar functionality