Merge pull request #30166 from imjakechapman/react-native-flip-card

Added type definitions for 'react-native-flip-card'
This commit is contained in:
Armando Aguirre
2018-11-05 15:29:15 -08:00
committed by GitHub
4 changed files with 106 additions and 0 deletions
+46
View File
@@ -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 <https://github.com/imjakechapman>
// 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<ViewStyle>;
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<FaceProps>;
export const Back: ComponentClass<BackProps>;
export default class FlipCard extends Component<FlipCardProps> {}
@@ -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 (
<FlipCard
style={{ backgroundColor: "#fff" }}
flip={false}
friction={10}
perspective={10}
flipHorizontal={true}
flipVertical={false}
clickable={true}
onFlipStart={() => {}}
onFlipEnd={() => {}}
alignHeight={false}
alignWidth={false}
useNativeDriver={true}
>
<View>
<Text>Front</Text>
</View>
<View>
<Text>Back</Text>
</View>
</FlipCard>
);
}
}
@@ -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"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}