Skip to content

Commit 35724d9

Browse files
matt-oakesjanicduplessis
authored andcommitted
Export the interfaces in TypeScript (react-native-image-picker#1042)
1 parent 6569a31 commit 35724d9

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

index.d.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare module "react-native-image-picker" {
22

3-
interface Response {
3+
interface ImagePickerResponse {
44
customButton: string;
55
didCancel: boolean;
66
error: string;
@@ -19,17 +19,17 @@ declare module "react-native-image-picker" {
1919
timestamp?: string;
2020
}
2121

22-
interface CustomButtonOptions {
22+
interface ImagePickerCustomButtonOptions {
2323
name?: string;
2424
title?: string;
2525
}
2626

27-
interface Options {
27+
interface ImagePickerOptions {
2828
title?: string;
2929
cancelButtonTitle?: string;
3030
takePhotoButtonTitle?: string;
3131
chooseFromLibraryButtonTitle?: string;
32-
customButtons?: Array<CustomButtonOptions>;
32+
customButtons?: Array<ImagePickerCustomButtonOptions>;
3333
cameraType?: 'front' | 'back';
3434
mediaType?: 'photo' | 'video' | 'mixed';
3535
maxWidth?: number;
@@ -40,23 +40,21 @@ declare module "react-native-image-picker" {
4040
rotation?: number;
4141
allowsEditing?: boolean;
4242
noData?: boolean;
43-
storageOptions?: StorageOptions;
43+
storageOptions?: ImagePickerStorageOptions;
4444
}
4545

46-
interface StorageOptions {
46+
interface ImagePickerStorageOptions {
4747
skipBackup?: boolean;
4848
path?: string;
4949
cameraRoll?: boolean;
5050
waitUntilSaved?: boolean;
5151
}
5252

5353

54-
class ImagePicker {
55-
static showImagePicker(options: Options, callback: (response: Response) => void): void;
56-
static launchCamera(options: Options, callback: (response: Response) => void): void;
57-
static launchImageLibrary(options: Options, callback: (response: Response) => void): void;
54+
export default class ImagePicker {
55+
static showImagePicker(options: ImagePickerOptions, callback: (response: ImagePickerResponse) => void): void;
56+
static launchCamera(options: ImagePickerOptions, callback: (response: ImagePickerResponse) => void): void;
57+
static launchImageLibrary(options: ImagePickerOptions, callback: (response: ImagePickerResponse) => void): void;
5858
}
5959

60-
export = ImagePicker;
61-
6260
}

0 commit comments

Comments
 (0)