From 3e13aec055cd43183dd0ddc62434389cb376fb45 Mon Sep 17 00:00:00 2001 From: Ifiok Jr Date: Fri, 11 May 2018 20:27:17 +0100 Subject: [PATCH] add type definition for react-native-indicators (#25612) --- types/react-native-indicators/index.d.ts | 211 ++++++++++++++++++ .../react-native-indicators-tests.tsx | 14 ++ types/react-native-indicators/tsconfig.json | 24 ++ types/react-native-indicators/tslint.json | 1 + 4 files changed, 250 insertions(+) create mode 100644 types/react-native-indicators/index.d.ts create mode 100644 types/react-native-indicators/react-native-indicators-tests.tsx create mode 100644 types/react-native-indicators/tsconfig.json create mode 100644 types/react-native-indicators/tslint.json diff --git a/types/react-native-indicators/index.d.ts b/types/react-native-indicators/index.d.ts new file mode 100644 index 0000000000..ee4a13a4c2 --- /dev/null +++ b/types/react-native-indicators/index.d.ts @@ -0,0 +1,211 @@ +// Type definitions for react-native-indicators 0.13 +// Project: https://github.com/n4kz/react-native-indicators#readme +// Definitions by: Ifiok Jr. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import { Component } from 'react'; +import { Animated, EasingFunction } from 'react-native'; +export interface BaseIndicatorProps { + /** + * Animation easing function + * @default Easing.linear + */ + animationEasing?: EasingFunction; + + /** + * Animation duration in ms + * @default1200 + */ + animationDuration?: number; +} + +export interface UIActivityIndicatorProps extends BaseIndicatorProps { + /** + * Component color + * @default 'rgb(0, 0, 0)' + */ + color?: string; + /** + * Component count + * @default 12 + */ + count?: number; + /** + * Base component size + * @default 40 + */ + size?: number; +} + +export class UIActivityIndicator extends Component< + UIActivityIndicatorProps +> {} + +export interface BallIndicatorProps extends BaseIndicatorProps { + /** + * Component color + * @default 'rgb(0, 0, 0)' + */ + color?: string; + /** + * Component count + * @default 8 + */ + count?: number; + /** + * Base component size + * @default 40 + */ + size?: number; +} + +export class BallIndicator extends Component {} + +export interface BarIndicatorProps extends BaseIndicatorProps { + /** + * Component color + * @default 'rgb(0, 0, 0)' + */ + color?: string; + /** + * Component count + * @default 3 + */ + count?: number; + /** + * Base component size + * @default 40 + */ + size?: number; +} + +export class BarIndicator extends Component {} + +export interface DotIndicatorProps extends BaseIndicatorProps { + /** + * Component color + * @default 'rgb(0, 0, 0)' + */ + color?: string; + /** + * Component count + * @default 4 + */ + count?: number; + /** + * Base component size + * @default 16 + */ + size?: number; +} + +export class DotIndicator extends Component {} + +export interface MaterialIndicatorProps extends BaseIndicatorProps { + /** + * Component color + * @default 'rgb(0, 0, 0)' + */ + color?: string; + + /** + * Base component size + * @default 40 + */ + size?: number; +} + +export class MaterialIndicator extends Component {} + +export interface PulseIndicatorProps extends BaseIndicatorProps { + /** + * Component color + * @default 'rgb(0, 0, 0)' + */ + color?: string; + + /** + * Base component size + * @default 40 + */ + size?: number; +} + +export class PulseIndicator extends Component {} + +export interface PacmanIndicatorProps extends BaseIndicatorProps { + /** + * Component color + * @default 'rgb(0, 0, 0)' + */ + color?: string; + + /** + * Base component size + * @default 48 + */ + size?: number; +} + +export class PacmanIndicator extends Component {} + +export interface SkypeIndicatorProps extends BaseIndicatorProps { + /** + * Component color + * @default 'rgb(0, 0, 0)' + */ + color?: string; + /** + * Component count + * @default 5 + */ + count?: number; + /** + * Base component size + * @default 40 + */ + size?: number; + /** + * Minimum component scale + * @default 0.2 + */ + minScale?: number; + /** + * Maximum component scale + * @default 1.0 + */ + maxScale?: number; +} + +export class SkypeIndicator extends Component {} + +export interface WaveIndicatorProps extends BaseIndicatorProps { + /** + * Component color + * @default 'rgb(0, 0, 0)' + */ + color?: string; + /** + * Component count + * @default 4 + */ + count?: number; + /** + * Base component size + * @default 40 + */ + size?: number; + /** + * Minimum component scale + * @default 0.54 + */ + waveFactor?: number; + /** + * Maximum component scale + * @default 'fill' + */ + waveMode?: 'fill' | 'outline'; +} + +export class WaveIndicator extends Component {} diff --git a/types/react-native-indicators/react-native-indicators-tests.tsx b/types/react-native-indicators/react-native-indicators-tests.tsx new file mode 100644 index 0000000000..c3b11151f3 --- /dev/null +++ b/types/react-native-indicators/react-native-indicators-tests.tsx @@ -0,0 +1,14 @@ +import * as React from 'react'; +import { + DotIndicator, +} from 'react-native-indicators'; + +class Example extends React.Component { + render() { + return ( + + + + ); + } +} diff --git a/types/react-native-indicators/tsconfig.json b/types/react-native-indicators/tsconfig.json new file mode 100644 index 0000000000..ee6af547c4 --- /dev/null +++ b/types/react-native-indicators/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-indicators-tests.tsx" + ] +} diff --git a/types/react-native-indicators/tslint.json b/types/react-native-indicators/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-indicators/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }