I'm using the launchImageLibrary function from the react-native-image-picker library. I am able to to select images from my library but the selected image doesn't show up on my app but its shows that the uri has changed in the console. Here's a piece of my code.
chooseImage = () => {
let options = {
maxWidth: 300,
maxHeight: 300,
storageOptions: {
skipBackup: true,
path: 'images',
cameraRoll: true,
},
};
launchImageLibrary(options, response => {
console.log('Response = ', response);
if (response.didCancel) {
console.log('User cancelled image picker');
} else if (response.error) {
console.log('ImagePicker Error: ', response.error);
} else {
this.setState({
fileUri: response.assets[0].uri,
});
console.log(this.state.fileUri);
}
});
<TouchableOpacity
activeOpacity={0.8}
onPress={this.chooseImage}
style={{
width: 300,
height: 300,
backgroundColor: COLORS.dark,
alignItems: 'center',
justifyContent: 'center',
}}>
{this.state.fileUri ? (
<Image source={{ uri: this.state.fileUri }} />
) : (
<Icon name="add-a-photo" size={40} color={COLORS.inactive} />
)}
</TouchableOpacity>