I am currently working on a component that displays an image. This component requires both a URL and a style to be passed in.
interface FastImageProps {
styleComponent: StyleProp<ImageStyle> | StyleProp<ImageStyle>[];
url: string;
}
export const FastImageComponent: React.FC<FastImageProps> = ({
styleComponent,
url,
}: any) => {
return (
<FastImage
style={styleComponent}
source={{
uri: `WEB_PATH/${url}`,
priority: FastImage.priority.normal,
cache: FastImage.cacheControl.immutable,
}}
resizeMode={FastImage.resizeMode.cover}
/>
);
};
The component is functioning properly, however it currently uses "any" type. If I remove the "any" type, an error occurs indicating:
No overload matches this call.
....(error message continues)
This is how I am currently using the component:
<FastImageComponent
styleComponent={{width: sizeWidth(20), height: sizeWidth(20)}}
url={imageUrl}/>
I am seeking assistance in understanding why this error is occurring and what changes are needed to remove the dependency on "any" type.