I am using the react native swiper and am unable to see the photos I am requiring. Am I calling the photos incorrectly? When I try and display the photo like normal with an Image tag it works so I know I am importing the photo from the correct directory.
....
import Swiper from 'react-native-swiper';
....
const ProfileCardScreen = ({navigation}) => {
var profilePhotos=[{image:require('../images/NYE.jpg')},{image:require('../images/hiking.jpg')},{image:require('../images/baseball.jpg')}];
return (
<View style = {styles.container}>
<Text style={styles.profilePageUserName}>User Name Here</Text>
<Swiper showsButtons={true}>
<View style={styles.slide1}>
<Image style={{flex:1, height: undefined, width: undefined}}
resizeMode="contain"
source={require('../images/NYE.jpg')}/>
</View>
<View style={styles.slide2}>
<Image style={{flex:1, height: undefined, width: undefined}}
resizeMode="contain"
source={require('../images/hiking.jpg')}/>
</View>
<View style={styles.slide3}>
<Image style={{flex:1, height: undefined, width: undefined}}
resizeMode="contain"
source={require('../images/baseball.jpg')}/>
</View>
</Swiper>
The Syntax is correct, Try importing images in import statement like
If the above code also doesn't works then there must be any problem in your styling. That's all I can do.