Merge pull request #22536 from plantain-00/react-native-document-picker

add types of react-native-document-picker
This commit is contained in:
Paul van Brenk
2017-12-28 16:05:45 -08:00
committed by GitHub
4 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
// Type definitions for react-native-document-picker 2.0
// Project: https://github.com/Elyx0/react-native-document-picker
// Definitions by: Jacob Baskin <https://github.com/plantain-00>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export const DocumentPicker: {
show(options: Options, callback: (error: Error, result: Result) => void): void;
};
export const DocumentPickerUtil: {
allFiles(): string;
pdf(): string;
audio(): string;
plainText(): string;
};
export interface Options {
top?: number;
left?: number;
filetype: string[];
}
export interface Result {
uri: string;
type: string;
fileName: string;
fileSize: number;
}

View File

@@ -0,0 +1,7 @@
import { DocumentPicker, DocumentPickerUtil } from "react-native-document-picker";
DocumentPicker.show({
filetype: [DocumentPickerUtil.allFiles()],
}, (error, res) => {
// do nothing
});

View File

@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
},
"files": [
"index.d.ts",
"react-native-document-picker-tests.tsx"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }