show image from file path react native code example
Example: react native image file path variable
// Need to have all variable files already set with require
const images = {
profile: {
profile: require('./profile/profile.png'),
comments: require('./profile/comments.png'),
},
image1: require('./image1.jpg'),
image2: require('./image2.jpg'),
};
return (
<View>
{
props.profile ? <Image source={images.profile.profile} /> : <Image source={images.profile.comments} />
}
</View>
)