mirror of
https://github.com/mudabbir-ahmad/Project-MAD-crudler.git
synced 2026-10-07 20:40:20 +00:00
Added Alert for Delete
This commit is contained in:
1 parent
d8b40c9d41
commit
1f296314f4
1 file changed
+15
-4
@@ -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>
|
||||
|
||||
|
||||
Reference in new issue
Block a user