【发布时间】:2023-03-11 10:01:01
【问题描述】:
我正在尝试从平面列表中删除一个项目,但在删除它之前有一个警告询问“你确定要删除它吗”。
但我不知道该怎么做。
这是警报
<AwesomeAlert
show={showAlert}
title="UYARI!"
message="Are you sure to remove it?"
closeOnTouchOutside={false}
closeOnHardwareBackPress={false}
showCancelButton={true}
showConfirmButton={true}
cancelText="Hayır"
confirmText="Evet"
confirmButtonColor="#DD5555"
onCancelPressed={() => {
setShowAlert(false);
}}
onConfirmPressed={() => {
//what should i do here ?
setShowAlert(false);
}}
/>
这是平面列表渲染项
const barcodeList = barcodeArray => {
return (
<View style={styles.ListItemContainer}>
<Text>-{barcodeArray.item}</Text>
<TouchableOpacity onPress={() => removeItem(barcodeArray.item)}>
//this removeItem func is remove it without confirmation
<Text style={{fontSize: 20, fontWeight: 'bold'}}>X</Text>
</TouchableOpacity>
</View>
);
};
【问题讨论】:
标签: react-native alert react-native-flatlist