-
-
Save godswillokokon/59b07bf7a030787cc60c8be895674561 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
import React, { useState } from 'react' | |
import { | |
... | |
} from 'react-native'; | |
import ImagePicker from 'react-native-image-picker'; | |
const App = () => { | |
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, | |
} | |
} | |
}); | |
} | |
return ( | |
<View> | |
... | |
</View > | |
); | |
}; | |
const styles = StyleSheet.create({ | |
... | |
}); | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment