import React, { useMemo } from 'react'; import { Animated, View, Dimensions, ScrollViewProps, ScrollView, } from 'react-native'; import { commonStyles as styles } from './styles'; import { StretchyComponentProps, PropsWithStretchy, WithStretchy, } from './withStretchy'; const WINDOW_HEIGHT = Dimensions.get('window').height; export type StretchyScrollViewProps = React.PropsWithChildren< PropsWithStretchy> >; const StretchyScrollView = React.forwardRef< ScrollView, StretchyScrollViewProps >( ( { backgroundColor, children, foreground, imageHeight, onScroll, stretchy, style, ...otherProps }, ref, ) => { const contentMinHeight = useMemo( () => stretchy.heightBasedOnRatio ? WINDOW_HEIGHT - stretchy.heightBasedOnRatio : 0, [stretchy.heightBasedOnRatio], ); return ( {foreground} {children} ); }, ); export default WithStretchy(StretchyScrollView);