Skip to content

Commit

Permalink
added typescript typing definition (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
hktonylee authored and Marc Shilling committed Nov 28, 2016
1 parent 0c5df24 commit a9c036c
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
61 changes: 61 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

declare module "react-native-image-picker" {

export interface Response {
didCancel: boolean;
error: string;
data: string;
uri: string;
origURL?: string;
isVertical: boolean;
width: number;
height: number;
fileSize: number;
type?: string;
fileName?: string;
path?: string;
latitude?: number;
longitude?: number;
timestamp?: string;
}

export interface CustomButtonOptions {
name?: string;
title?: string;
}

export interface Options {
title?: string;
cancelButtonTitle?: string;
takePhotoButtonTitle?: string;
chooseFromLibraryButtonTitle?: string;
customButtons?: Array<CustomButtonOptions>;
cameraType?: 'front' | 'back';
mediaType?: 'photo' | 'video' | 'mixed';
maxWidth?: number;
maxHeight?: number;
quality?: number;
videoQuality?: 'low' | 'medium' | 'high';
durationLimit?: number;
rotation?: number;
allowsEditing?: boolean;
noData?: boolean;
storageOptions?: StorageOptions;
}

export interface StorageOptions {
skipBackup?: boolean;
path?: string;
cameraRoll?: boolean;
waitUntilSaved?: boolean;
}


export default class ImagePicker {
static showImagePicker(options: Options, callback: (response: Response) => void): void;
static launchCamera(options: Options, callback: (response: Response) => void): void;
static launchImageLibrary(options: Options, callback: (response: Response) => void): void;
}

}

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
],
"scripts": {
"prepublish": "rm -rf android/build Example/android/build Example/android/app/build"
}
},
"types": "./index.d.ts"
}

0 comments on commit a9c036c

Please sign in to comment.