buttons work, all modal ready
This commit is contained in:
@@ -8,6 +8,7 @@ import { WrapperButtons, WrapperAddItem, WrapperAddList, WrapperRemove, WrapperS
|
||||
import { useSelector, useDispatch } from 'react-redux'
|
||||
import { itemsRemoved, checkAll } from '../../../redux/slices/groceryList/itemsSlice'
|
||||
import { selectOpenListId } from '../../../redux/slices/groceryList/listsSlice'
|
||||
import { Alert } from 'react-native'
|
||||
|
||||
const SelectAllItemsButton = (props) => {
|
||||
const dispatch = useDispatch()
|
||||
@@ -27,10 +28,20 @@ const RemoveItemsButton = (props) => {
|
||||
const dispatch = useDispatch()
|
||||
const [toggleAnim, setToggleAnim] = useState(false)
|
||||
const handlePress = () => {
|
||||
if (window.confirm("Do you really want to remove the selected items?")) {
|
||||
dispatch(itemsRemoved())
|
||||
setToggleAnim(!toggleAnim)
|
||||
}
|
||||
Alert.alert(
|
||||
"Warning",
|
||||
"Are you sure you want to remove the selected items?",
|
||||
[
|
||||
{ text: "Cancel", },
|
||||
{
|
||||
text: "Remove", onPress: () => {
|
||||
dispatch(itemsRemoved())
|
||||
setToggleAnim(!toggleAnim)
|
||||
}
|
||||
}
|
||||
],
|
||||
{ cancelable: true, }
|
||||
)
|
||||
}
|
||||
return (
|
||||
<WrapperRemove toggle={toggleAnim} visible={props.visible} onPress={handlePress}>
|
||||
|
||||
Reference in New Issue
Block a user