import React, { useCallback, useRef, useState } from 'react'; import { Animated, Dimensions, View, Text, Image } from 'react-native'; import AnimatedMenuVertically from './components/AnimatedMenus/AnimatedMenuVertically'; import { Container, AnimatedComponentBox, Box, ToggleButton, SectionComponentBox, AnimationCardBox } from './global/styles'; import GradientText from './components/GradientText'; import AnimatedMenuHorizontally from './components/AnimatedMenus/AnimatedMenuHorizontaly'; import { widthPercentageToDP as wp, heightPercentageToDP as hp } from 'react-native-responsive-screen'; import SaveElasticButton from './components/InstagramActions/SaveElasticButton'; import LikeElasticButton from './components/InstagramActions/LikeElasticButton'; import CommentsNormal from '~/assets/icons/comments-regular.svg'; import CommentsSolid from '~/assets/icons/comments-solid.svg'; import EyeNormal from '~/assets/icons/eye-regular.svg'; import EyeSolid from '~/assets/icons/eye-slash-solid.svg'; import FolderNormal from '~/assets/icons/folder-open-regular.svg'; import FolderSolid from '~/assets/icons/folder-solid.svg'; import CustomElasticButton from './components/InstagramActions/CustomElasticButton'; import ParallaxAddButton from './components/AddActions/ParallaxAddButton'; import RotateAddButton from './components/AddActions/RotateAddButton'; import SubtractAddButton from './components/AddActions/SubtractAddButton'; export const MicroAnimations: React.FC = () => { const [positionPagination, setPositionPagination] = useState(0); const { width, height } = Dimensions.get('window'); const animationPaginatedRef = useRef(null); const onPressEvent = () => { console.log("Faça alguma coisa aqui") } const activityColor = { backgroundColor: "#a78ebf", borderColor: "#a78ebf", } function getCurrentPage(scrollXOfPage: number) { const pageWidth = Math.round(scrollXOfPage / width); setPositionPagination(pageWidth) } const changePage = (pageIndex: number) => { animationPaginatedRef?.current?.scrollToOffset({ offset: pageIndex * width, }); } return ( item} renderItem={({ item, index }) => { changePage(index) }}> {item} } horizontal showsHorizontalScrollIndicator={false} /> item.toString()} renderItem={({ item, index }) => { return ( { index === 0 && ( ) } { index === 1 && ( ) } { index === 2 && ( Save Action Button console.log("teste")} /> Like Action Button Custom Action Button } endIcon={} /> } endIcon={} /> } endIcon={} onPress={onPressEvent} /> ) } { index === 3 && ( Parallax Add Button Rotate Add Button Subtract Add Button ) } ) }} horizontal pagingEnabled showsHorizontalScrollIndicator={false} onScroll={e => { let contentOffset = e.nativeEvent.contentOffset; getCurrentPage(contentOffset.x); }} /> ); }