import { Ionicons } from "@expo/vector-icons"; import { router } from "expo-router"; import type { PropsWithChildren, ReactElement } from "react"; import { TouchableOpacity, View } from "react-native"; import Animated, { interpolate, useAnimatedRef, useAnimatedStyle, useScrollViewOffset, } from "react-native-reanimated"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { Chromecast } from "./Chromecast"; const HEADER_HEIGHT = 400; type Props = PropsWithChildren<{ headerImage: ReactElement; logo?: ReactElement; }>; export const ParallaxScrollView: React.FC = ({ children, headerImage, logo, }: Props) => { const scrollRef = useAnimatedRef(); const scrollOffset = useScrollViewOffset(scrollRef); const headerAnimatedStyle = useAnimatedStyle(() => { return { transform: [ { translateY: interpolate( scrollOffset.value, [-HEADER_HEIGHT, 0, HEADER_HEIGHT], [-HEADER_HEIGHT / 2, 0, HEADER_HEIGHT * 0.75], ), }, { scale: interpolate( scrollOffset.value, [-HEADER_HEIGHT, 0, HEADER_HEIGHT], [2, 1, 1], ), }, ], }; }); const inset = useSafeAreaInsets(); return ( router.back()} className="absolute left-4 z-50 bg-black rounded-full p-2 border border-neutral-900" style={{ top: inset.top + 17, }} > {logo && ( {logo} )} {headerImage} {children} ); };