From 818719b10a76caaeea7fdb993fb4c66cfeeff7f3 Mon Sep 17 00:00:00 2001 From: Pablo Rocha Date: Thu, 19 Jul 2018 10:05:35 -0300 Subject: [PATCH 1/3] adding image-picker options --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index ebffccd..6b52b67 100644 --- a/index.js +++ b/index.js @@ -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 = { @@ -38,6 +39,7 @@ export default class PhotoUpload extends React.Component { } options = { + ... this.props.imagePickerOptions, title: this.props.pickerTitle || 'Select Photo', storageOptions: { skipBackup: true, From 3074b5e24713428791b19a60c68ed3975fec6958 Mon Sep 17 00:00:00 2001 From: Pablo Rocha Date: Thu, 19 Jul 2018 10:05:35 -0300 Subject: [PATCH 2/3] adding image-picker options --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ebffccd..920ab16 100644 --- a/index.js +++ b/index.js @@ -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 = { @@ -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' From df163666fea91f2605a896419b1baa9a1627c6e3 Mon Sep 17 00:00:00 2001 From: Pablo Rocha Date: Thu, 19 Jul 2018 10:27:27 -0300 Subject: [PATCH 3/3] updating example and props --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 5ab59ee..c564b6a 100644 --- a/README.md +++ b/README.md @@ -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', + } + } + { if (avatar) { console.log('Image base64 string: ', avatar) @@ -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