mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-28 12:37:00 +00:00
17 lines
470 B
JavaScript
17 lines
470 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
|