To send entire require('./images/logo.png') as a prop i have to create boolean to check if the image is from web or is being passed from a local folder. How to create this kind of boolean?
type ImageProps = {
imageName: string;
fromWeb: boolean;
};
export function CustomImage({ imageName, fromWeb }: ImageProps) {
return (
<View>
<Image style={styles.image} source={imageName} />
</View>
);
}
File from outside the component
function PassedImages() {
return (
<View>
<CustomImage fromWeb={false} imageName={require('./images/logo.png')}/>
</View>
);
}