@exodus/react-native-image-picker
Version:
A React Native module that allows you to use native UI to select media from the device library or directly from the camera
34 lines (30 loc) • 854 B
JavaScript
import { NativeModules } from 'react-native';
const { ImagePickerManager } = NativeModules;
const DEFAULT_OPTIONS = {
title: 'Select a Photo',
cancelButtonTitle: 'Cancel',
takePhotoButtonTitle: 'Take Photo…',
chooseFromLibraryButtonTitle: 'Choose from Library…',
quality: 1.0,
allowsEditing: false,
permissionDenied: {
title: 'Permission denied',
text:
'To be able to take pictures with your camera and choose images from your library.',
reTryTitle: 're-try',
okTitle: "I'm sure",
},
};
module.exports = {
...ImagePickerManager,
showImagePicker: function showImagePicker(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
return ImagePickerManager.showImagePicker(
{ ...DEFAULT_OPTIONS, ...options },
callback,
);
},
};