const deleteProduct = prod => {
Alert.alert(
'Delete Product',
`Are you sure you want to remove ${prod.id}?`,
[
{
text: 'Cancel',
style: 'cancel',
},
{
text: 'Delete',
style: 'destructive',
onPress: async (productKey = prod.item) => {
try {
await AsyncStorage.removeItem(productKey);
// RNRestart.Restart();
} catch (err) {
console.error(err);
}
},
},
],
);
};
I'm having trouble with the deleteProduct
, it won't delete the item even though I've followed the instructions on the documentation.
I attempted to delete an item using the onLongPress
event within a TouchableWithoutFeedback
element in a React Native app. The TouchableWithoutFeedback
is enclosed within a FlatList
.