-
-
Save godswillokokon/7f5c9542a894cad323e35b65892e7b37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
const selectPhotoTapped = () => { | |
const options = { | |
title: 'Select Photo', | |
storageOptions: { | |
skipBackup: true, | |
path: 'images', | |
}, | |
}; | |
ImagePicker.showImagePicker(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 { | |
const uri = response.uri; | |
const type = response.type; | |
const name = response.fileName; | |
const source = { | |
uri, | |
type, | |
name, | |
} | |
console.log("Image ", source) | |
} | |
}); | |
} | |
return ( | |
<View> | |
<View style={styles.imageContainer}> | |
<Image source={{ uri: 'https://res.cloudinary.com/ogcodes/image/upload/v1581387688/m0e7y6s5zkktpceh2moq.jpg' }} style={styles.backgroundImage}></Image> | |
</View> | |
<View style={styles.uploadContainer}> | |
<Text style={styles.uploadContainerTitle}>ImagePicker to Cloudinary</Text> | |
<TouchableOpacity onPress={selectPhotoTapped} style={styles.uploadButton}> | |
<Text style={styles.uploadButtonText}>Upload</Text> | |
</TouchableOpacity> | |
</View> | |
</View > | |
); | |
}; | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment