Skip to content

Commit 168410e

Browse files
committed
feat: capturePhotoOptions and libraryPhotoOptions props are available
1 parent 08d6fa2 commit 168410e

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ should work of the example project.
120120
| actionButtonUnderlayColor | string | rgba(0,0,0,0.3) | change the action button's underlay color |
121121
| cancelButtonUnderlayColor | string | rgba(200,200,200,0.1) | change the cancel button's underlay color |
122122
| includeBase64 | boolean | false | when you need `base64` |
123+
| capturePhotoOptions | CameraOptions | default | override the options for capturing the photo |
124+
| libraryPhotoOptions | ImageLibraryOptions | default | override the options for picking images from library |
123125

124126
## Future Plans
125127

lib/ImagePickerModal.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import PickerModal, {
44
IPickerModalProps,
55
} from "@freakycoder/react-native-picker-modal";
66
import {
7+
CameraOptions,
8+
ImageLibraryOptions,
79
launchCamera,
810
launchImageLibrary,
911
MediaType,
@@ -19,13 +21,17 @@ interface IImagePickerModalProps extends IPickerModalProps {
1921
isVisible: boolean;
2022
data: string[];
2123
includeBase64?: boolean;
24+
capturePhotoOptions?: CameraOptions;
25+
libraryPhotoOptions?: ImageLibraryOptions;
2226
onPress: (item: any) => void;
2327
}
2428

2529
const ImagePickerModal: React.FC<IImagePickerModalProps> = ({
2630
isVisible,
2731
data,
2832
onPress,
33+
capturePhotoOptions,
34+
libraryPhotoOptions,
2935
includeBase64 = false,
3036
...rest
3137
}) => {
@@ -37,7 +43,7 @@ const ImagePickerModal: React.FC<IImagePickerModalProps> = ({
3743
includeBase64: includeBase64,
3844
includeExtra: true,
3945
};
40-
const result = await launchCamera(options);
46+
const result = await launchCamera(capturePhotoOptions || options);
4147
onPress && onPress(result);
4248
} else if (selectedItem === data[1]) {
4349
const options = {
@@ -46,7 +52,7 @@ const ImagePickerModal: React.FC<IImagePickerModalProps> = ({
4652
includeBase64: includeBase64,
4753
includeExtra: true,
4854
};
49-
const result = await launchImageLibrary(options);
55+
const result = await launchImageLibrary(libraryPhotoOptions || options);
5056
onPress && onPress(result);
5157
}
5258
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-image-picker-modal",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Easy to use image picker modal with awesome iOS Picker design for React Native",
55
"main": "./build/dist/ImagePickerModal.js",
66
"repository": "[email protected]:WrathChaos/react-native-image-picker-modal.git",

0 commit comments

Comments
 (0)