Skip to content

Instantly share code, notes, and snippets.

@vaibhavgehani
Created August 5, 2022 07:12
Show Gist options
  • Select an option

  • Save vaibhavgehani/c73227f805148609df4a48721034e3dd to your computer and use it in GitHub Desktop.

Select an option

Save vaibhavgehani/c73227f805148609df4a48721034e3dd to your computer and use it in GitHub Desktop.
const launchNativeImageLibrary = () => {
let options = {
includeBase64: true,
storageOptions: {
skipBackup: true,
path: 'images',
},
};
launchImageLibrary(options, (response) => {
console.log('Response = ', response);
if (response.didCancel) {
console.log('User cancelled image picker');
} else if (response.errorCode) {
console.log('ImagePicker Error: ', response.error);
} else {
const source = { uri: response.assets.uri };
console.log('response', JSON.stringify(response));
setFileData(response.assets[0].base64);
setFileUri(response.assets[0].uri)
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment