import React, { useRef, useEffect, useState } from 'react'; import { StyleSheet, View, ScrollView, Text, Animated, TouchableOpacity, Image } from 'react-native'; import { useHeaderHeight } from '@react-navigation/stack'; //dependencies\ //components import { AddItemButton, PushItemsToStorageButton, RemoveItemsButton, AddNewRecipeButton } from '../../components/groceryComponents/GroceryListButtons'; import { ListedItem } from '../../components/groceryComponents/ListedItem'; //redux import { useSelector } from 'react-redux'; //themes import { COLORS } from '../../themes/Colors'; import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'; const AnimButtons = () => { const [toggle, setToggle] = useState(0); // toggle for sub-buttons const yValue = useRef(new Animated.Value(0)).current; // animation start value //animation: useEffect(() => { toggle ? Animated.spring(yValue, { toValue: 1, friction: 5, useNativeDriver: true, } ).start() : Animated.timing(yValue, { toValue: 0, duration: 200, useNativeDriver: true, } ).start() }, [toggle]) //components return ( {/* top button */} {/* middle button */} {/* bottom button */} {/* Button to toggle sub-buttons */} toggle ? setToggle(0) : setToggle(1)}> ); } function GroceryList() { const items = useSelector(state => state.items); const itemList = items.map((item, index) => { return }); return ( {/* Scroll */} {itemList} {/* buttons */} ); } const styles = StyleSheet.create({ container: { flex: 1, }, buttonsView: { flexDirection: 'row', position: 'absolute', alignItems: 'flex-start', left: 8, bottom: 10, //backgroundColor: 'red', }, itemLocation: { position: 'absolute', right: 8, bottom: 10, } }); export default GroceryList;