mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-19 01:24:18 +00:00
13 lines
443 B
JavaScript
13 lines
443 B
JavaScript
import * as ImagePicker from 'expo-image-picker'
|
|
|
|
function takePictureWithExpo () {
|
|
return ImagePicker.getCameraPermissionsAsync()
|
|
.then(({ granted }) => (granted
|
|
? ImagePicker.launchCameraAsync({ allowsEditing: true })
|
|
: Promise.reject(new Error('Permissions denied'))))
|
|
.then((result) => (!result.cancelled
|
|
? result
|
|
: Promise.reject(new Error('Operation cancelled'))))
|
|
}
|
|
|
|
export default takePictureWithExpo
|