import { Animated, ScrollView } from 'react-native'; import React, { forwardRef } from 'react'; import { HEADER_HEIGHT, IMG_HEADER_HEIGHT } from '../constants'; import AnimatedNavbar from './AnimatedNavbar'; import type { AnimatedScrollViewProps } from '../types'; import { useAnimateScrollView } from '../hooks/useAnimateScrollView'; import { AnimatedHeader } from './AnimatedHeader'; export const AnimatedScrollView = forwardRef< ScrollView, AnimatedScrollViewProps >( ( { TopNavBarComponent, HeaderNavbarComponent, HeaderComponent, headerMaxHeight, topBarHeight, topBarElevation, headerImage, disableScale, children, imageStyle, ...props }: AnimatedScrollViewProps, ref ) => { const imageHeight = headerMaxHeight || IMG_HEADER_HEIGHT; const headerNavHeight = topBarHeight || HEADER_HEIGHT; const headerElevation = topBarElevation || 0; const [scroll, onScroll, scale, translateYDown, translateYUp] = useAnimateScrollView(imageHeight, disableScale); return ( <> {children} ); } );