From a25d7799672222e2771c5bfe5c71a2a7d05cf768 Mon Sep 17 00:00:00 2001 From: Jake Chapman Date: Wed, 31 Oct 2018 08:36:59 -0700 Subject: [PATCH] Added definitions for 'react-native-flip-card' --- types/react-native-flip-card/index.d.ts | 46 +++++++++++++++++++ .../react-native-flip-card-tests.tsx | 33 +++++++++++++ types/react-native-flip-card/tsconfig.json | 24 ++++++++++ types/react-native-flip-card/tslint.json | 3 ++ 4 files changed, 106 insertions(+) create mode 100644 types/react-native-flip-card/index.d.ts create mode 100644 types/react-native-flip-card/react-native-flip-card-tests.tsx create mode 100644 types/react-native-flip-card/tsconfig.json create mode 100644 types/react-native-flip-card/tslint.json diff --git a/types/react-native-flip-card/index.d.ts b/types/react-native-flip-card/index.d.ts new file mode 100644 index 0000000000..6fc1156a1a --- /dev/null +++ b/types/react-native-flip-card/index.d.ts @@ -0,0 +1,46 @@ +// Type definitions for react-native-flip-card 3.5 +// Project: https://github.com/moschan/react-native-flip-card +// Definitions by: Jake Chapman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { Component, ReactNode, ComponentClass } from "react"; +import { + ViewProps, + TextProps, + StyleProp, + TextInputProps, + ViewStyle +} from "react-native"; + +// FlipCard +export interface FlipCardProps { + style?: StyleProp; + flip?: boolean; + friction?: number; + perspective?: number; + flipHorizontal?: boolean; + flipVertical?: boolean; + clickable?: boolean; + onFlipEnd?: () => void; + onFlipStart?: () => void; + alignHeight?: boolean; + alignWidth?: boolean; + useNativeDriver?: boolean; +} +// Face +export interface FaceProps { + chilren: JSX.Element[]; +} + +// Back +export interface BackProps { + flipHorizontal: boolean; + flipVertical: boolean; + perspective: number; + chilren: JSX.Element[]; +} + +export const Face: ComponentClass; +export const Back: ComponentClass; +export default class FlipCard extends Component {} diff --git a/types/react-native-flip-card/react-native-flip-card-tests.tsx b/types/react-native-flip-card/react-native-flip-card-tests.tsx new file mode 100644 index 0000000000..e741589be4 --- /dev/null +++ b/types/react-native-flip-card/react-native-flip-card-tests.tsx @@ -0,0 +1,33 @@ +import * as React from "react"; +import { View, Text, StyleSheet } from "react-native"; + +// Component +import FlipCard from "react-native-flip-card"; + +export default class FlipCardTest extends React.Component { + render() { + return ( + {}} + onFlipEnd={() => {}} + alignHeight={false} + alignWidth={false} + useNativeDriver={true} + > + + Front + + + Back + + + ); + } +} diff --git a/types/react-native-flip-card/tsconfig.json b/types/react-native-flip-card/tsconfig.json new file mode 100644 index 0000000000..92f1878d71 --- /dev/null +++ b/types/react-native-flip-card/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, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-native-flip-card-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-native-flip-card/tslint.json b/types/react-native-flip-card/tslint.json new file mode 100644 index 0000000000..30a1bdde2e --- /dev/null +++ b/types/react-native-flip-card/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file