Added Alert for Delete

This commit is contained in:
bobbert committed 2025-12-04 13:29:00 +00:00
1 parent d8b40c9d41
commit 1f296314f4
1 file changed
+15 -4
+15 -4
View File
@@ -1,4 +1,4 @@
import {StyleSheet, Text, View} from "react-native";
import {Alert, StyleSheet, Text, View} from "react-native";
import FullWidthImage from "react-native-fullwidth-image";
import {Button, ButtonTray} from "../../UI/Button";
import Icons from "../../UI/Icons.js"
@@ -10,6 +10,17 @@ const ModuleView = ({module, onDelete}) => {
const handleDelete = () => onDelete(module);
const requestDelete = () => {
Alert.alert(
'Delete Warning',
`Are you sure you want to delete module ${module.ModuleCode} ${module.ModuleName}?`,
[
{text: 'cancel'},
{text: 'Delete', onPress: handleDelete}
]
);
}
// View -----------------------
return (<View style={styles.container}>
@@ -28,9 +39,9 @@ const ModuleView = ({module, onDelete}) => {
<Button
icon={<Icons.Delete/>}
label={"Delete"}
styleButton={{backgroundColor: 'mistyrose'}}
styleLabel={{color: 'red'}}
onClick={handleDelete}
// styleButton={{backgroundColor: 'mistyrose'}}
// styleLabel={{color: 'red'}}
onClick={requestDelete}
/>
</ButtonTray>