import React from 'react'; import {StyleSheet, ViewStyle} from 'react-native'; import Animated, { useAnimatedStyle, useDerivedValue, interpolate, Extrapolate, } from 'react-native-reanimated'; import {useSafeAreaInsets} from 'react-native-safe-area-context'; interface SearchResultsBackgroundProps { animationProgress: Animated.SharedValue; searchBarHeight: number; searching: boolean; } const SearchResultsBackground: React.FC = ({ animationProgress, searchBarHeight, searching, children, }) => { const {top: topInset} = useSafeAreaInsets(); /* * On-search container style (opacity fade-in). */ const backgroundAnimatedStyles = useAnimatedStyle(() => ({ opacity: animationProgress.value, })); /* * Derived animation value for contentAnimatedStyles. */ const contentAnimationProgress = useDerivedValue(() => interpolate(animationProgress.value, [0.9, 1], [0, 1], Extrapolate.CLAMP), ); /* * On-search content style (delayed opacity fade-in). */ const contentAnimatedStyles = useAnimatedStyle(() => ({ opacity: contentAnimationProgress.value, })); return ( {children} ); }; const styles = StyleSheet.create({ container: { ...StyleSheet.absoluteFillObject, backgroundColor: 'white', }, contentContainer: { flex: 1, }, }); export default SearchResultsBackground;