I need to show images as carousel and I can’t require them properly. I tried to require them in json like this {“Image”: require(“$PATH”)} or in js file in ParalaxImage tag but nothing….
item creator
_renderItem ({item, index}, parallaxProps) {
return (
<View style={styles.item}>
<ParallaxImage
source={item.landscapeImage}
containerStyle={styles.imageContainer}
style={styles.image}
parallaxFactor={0.4}
{...parallaxProps}
/>
</View>
);
}
JSON file
[
{
"name": "snydercut",
"image": "../../assets/moviePictures/snydercut.jpeg",
"landscapeImage": "../../assets/moviePictures/snydercutLandscape.jpeg"
},
{
"name": "batman",
"image": "../../assets/moviePictures/batman.jpeg",
"landscapeImage": "../../assets/moviePictures/batmanLandscape.jpeg"
},
{
"name": "avatar",
"image": "../../assets/moviePictures/avatar.jpeg",
"landscapeImage": "../../assets/moviePictures/avatarLandscape.jpeg"
}
]
and here is my carousel code
render () {
return (
<Carousel
sliderWidth={screenWidth}
sliderHeight={screenWidth}
itemWidth={screenWidth - 60}
data={moviePictures}
renderItem={this._renderItem}
hasParallaxImages={true}
/>
);
}