React-native-image-slider (cannot Display Local Images)
My local images don't display when using react-native-image-slider import React, { Component } from 'react'; import { View, Text, StyleSheet, Button, Image,
Solution 1:
For local image, use require
;
images={[
require('../assets/img/art_1.png'),
require('../assets/img/art_2.png'),
require('../assets/img/art_3.png'),
]}
Solution 2:
Try this:
<Image source={item} style={styles.customImage} resizeMode={'contain'} />
- instead of -
<Image source={{ uri: item }} style={styles.customImage} />
const profileSlider = [
// 'https://placeimg.com/640/640/nature',
// 'https://placeimg.com/640/640/people',
// 'https://placeimg.com/640/640/animals',
// 'https://placeimg.com/640/640/beer',
require('../images/slider/animals.png'),
require('../images/slider/beer.png'),
require('../images/slider/nature.png'),
require('../images/slider/people.png'),
];
Solution 3:
Try this one
dataSource = {
[{
url: require('../assets/img/RPImages/RP111_1.jpg')
},
{
url: require('../assets/img/RPImages/RP111_2.jpg')
},
]
}
Post a Comment for "React-native-image-slider (cannot Display Local Images)"