Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,23 @@ check the docs of each library on how to link manually.
import { Image } from 'react-native'
import PhotoUpload from 'react-native-photo-upload'

const imagePickerOptions = {
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',
}
}

<PhotoUpload
imagePickerOptions={imagePickerOptions}
onPhotoSelect={avatar => {
if (avatar) {
console.log('Image base64 string: ', avatar)
Expand Down Expand Up @@ -134,4 +150,5 @@ check the docs of each library on how to link manually.
onResponse | Function | fires on response exists
onRender | Function | fires after render
onResizedImageUri | Function | fires when image resized is ready
imagePickerOptions | Object | extension of [react-native-image-picker](https://github.com/react-community/react-native-image-picker/blob/f2e55452d9823c747eb98274fa62d346972b152c/index.js) options

4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default class PhotoUpload extends React.Component {
onResponse: PropTypes.func, // on response exists!
onRender: PropTypes.func, // after render
onResizedImageUri: PropTypes.func, // when image resized is ready
imagePickerOptions: PropTypes.object, // extension of react-native-image-picker options
}

state = {
Expand All @@ -37,8 +38,9 @@ export default class PhotoUpload extends React.Component {
buttonDisabled: false
}

options = {
options = {
title: this.props.pickerTitle || 'Select Photo',
... this.props.imagePickerOptions,
storageOptions: {
skipBackup: true,
path: 'images'
Expand Down