I have developed chat view in React Native using gifted chat lib. But i want to perform delete action on click of chat bubble.
I have try custom renderCustomView ,lightboxProps and onLongPress props but none of is working.
add onLongPress to GiftedChat component like this
<GiftedChat
onLongPress={this.onLongPress}
....
....
/>
onLongPress returns context, message
. Then you can show an ActionSheet and add your logic to delete.
onLongPress(context, message) {
console.log(context, message);
const options = ['Delete Message', 'Cancel'];
const cancelButtonIndex = options.length - 1;
context.actionSheet().showActionSheetWithOptions({
options,
cancelButtonIndex
}, (buttonIndex) => {
switch (buttonIndex) {
case 0:
// Your delete logic
break;
case 1:
break;
}
});
}