add type definition for react-native-indicators (#25612)

This commit is contained in:
Ifiok Jr
2018-05-11 12:27:17 -07:00
committed by Sheetal Nandi
parent 11a43248e5
commit 3e13aec055
4 changed files with 250 additions and 0 deletions
+211
View File
@@ -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. <https://github.com/ifiokjr>
// 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<BallIndicatorProps> {}
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<BarIndicatorProps> {}
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<DotIndicatorProps> {}
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<MaterialIndicatorProps> {}
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<PulseIndicatorProps> {}
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<PacmanIndicatorProps> {}
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<SkypeIndicatorProps> {}
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<WaveIndicatorProps> {}
@@ -0,0 +1,14 @@
import * as React from 'react';
import {
DotIndicator,
} from 'react-native-indicators';
class Example extends React.Component {
render() {
return (
<React.Fragment>
<DotIndicator color='white' />
</React.Fragment>
);
}
}
@@ -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"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }