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 FullWidthImage from "react-native-fullwidth-image";
import {Button, ButtonTray} from "../../UI/Button"; import {Button, ButtonTray} from "../../UI/Button";
import Icons from "../../UI/Icons.js" import Icons from "../../UI/Icons.js"
@@ -10,6 +10,17 @@ const ModuleView = ({module, onDelete}) => {
const handleDelete = () => onDelete(module); 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 ----------------------- // View -----------------------
return (<View style={styles.container}> return (<View style={styles.container}>
@@ -28,9 +39,9 @@ const ModuleView = ({module, onDelete}) => {
<Button <Button
icon={<Icons.Delete/>} icon={<Icons.Delete/>}
label={"Delete"} label={"Delete"}
styleButton={{backgroundColor: 'mistyrose'}} // styleButton={{backgroundColor: 'mistyrose'}}
styleLabel={{color: 'red'}} // styleLabel={{color: 'red'}}
onClick={handleDelete} onClick={requestDelete}
/> />
</ButtonTray> </ButtonTray>