import React from 'react';
import { View, Animated } from 'react-native';
import { commonStyles } from './styles';
import { StretchyProps } from '../types';
import { StretchyImage } from './stretchyImage';
import { useStretchy, UseStretchyOutput } from '../hooks/useStretchy';
export type PropsWithStretchy
= P & {
stretchy: UseStretchyOutput;
};
export type StretchyComponentProps = StretchyProps &
Omit, 'onScroll'>;
export const WithStretchy = (
WrappedComponent: React.ForwardRefExoticComponent<
React.PropsWithChildren>> &
React.RefAttributes
>,
) => {
const EnhancedComponent = React.forwardRef<
R,
React.PropsWithChildren>
>((props, ref) => {
const {
backgroundColor,
image,
imageOverlay,
imageHeight,
imageWrapperStyle,
imageResizeMode,
onScroll,
} = props;
const stretchy = useStretchy({
image,
scrollListener: onScroll,
});
return (
);
});
return EnhancedComponent;
};