From d7fa07ae582bfdf0f4a98b4c026d4b9f8160b2ce Mon Sep 17 00:00:00 2001 From: Phil Nova Date: Mon, 4 Jun 2018 10:43:53 -0700 Subject: [PATCH] Create typings for react-native-custom-tabs --- types/react-native-custom-tabs/index.d.ts | 22 +++++++++++++++++ .../react-native-custom-tabs-tests.ts | 10 ++++++++ types/react-native-custom-tabs/tsconfig.json | 24 +++++++++++++++++++ types/react-native-custom-tabs/tslint.json | 1 + 4 files changed, 57 insertions(+) create mode 100644 types/react-native-custom-tabs/index.d.ts create mode 100644 types/react-native-custom-tabs/react-native-custom-tabs-tests.ts create mode 100644 types/react-native-custom-tabs/tsconfig.json create mode 100644 types/react-native-custom-tabs/tslint.json diff --git a/types/react-native-custom-tabs/index.d.ts b/types/react-native-custom-tabs/index.d.ts new file mode 100644 index 0000000000..6b41fd9b62 --- /dev/null +++ b/types/react-native-custom-tabs/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for react-native-custom-tabs 0.1 +// Project: https://github.com/droibit/react-native-custom-tabs/pull/28 +// Definitions by: Phil Nova +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface Animations { + startEnter: string; + startExit: string; + endEnter: string; + endExit: string; +} + +export interface CustomTabsOptions { + toolbarColor?: string; + enableUrlBarHiding?: boolean; + showPageTitle?: boolean; + enableDefaultShare?: boolean; + animations?: Animations; + headers?: any; +} + +export function openURL(url: string, options?: CustomTabsOptions): Promise; diff --git a/types/react-native-custom-tabs/react-native-custom-tabs-tests.ts b/types/react-native-custom-tabs/react-native-custom-tabs-tests.ts new file mode 100644 index 0000000000..86dad3b3ee --- /dev/null +++ b/types/react-native-custom-tabs/react-native-custom-tabs-tests.ts @@ -0,0 +1,10 @@ +import * as ReactNativeCustomTabs from 'react-native-custom-tabs'; + +const rnt: ReactNativeCustomTabs.CustomTabsOptions = { + toolbarColor: 'blue', + enableUrlBarHiding: false, + showPageTitle: true, + enableDefaultShare: true, +}; + +const url: Promise = ReactNativeCustomTabs.openURL('testurl.com', rnt); diff --git a/types/react-native-custom-tabs/tsconfig.json b/types/react-native-custom-tabs/tsconfig.json new file mode 100644 index 0000000000..fcbc50b580 --- /dev/null +++ b/types/react-native-custom-tabs/tsconfig.json @@ -0,0 +1,24 @@ + +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-native-custom-tabs-tests.ts" + ] +} \ No newline at end of file diff --git a/types/react-native-custom-tabs/tslint.json b/types/react-native-custom-tabs/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/react-native-custom-tabs/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file