buttons work, all modal ready

This commit is contained in:
2021-11-01 16:09:24 +01:00
parent dcde2c35fb
commit 42be0512bf
13 changed files with 6070 additions and 52 deletions

View File

@@ -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}>