Added definitions for react-native-input-spinner (#43678)

* lint and config added

* input spinner typings added

* test file added

* updated with semi colons

* version fix

* version test fix
This commit is contained in:
mkrishnan-codes 2020-04-07 02:17:40 +05:30 committed by GitHub
parent 1d68e381aa
commit 74a8df8b7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,58 @@
// Type definitions for react-native-input-spinner 1.2
// Project: https://github.com/marcocesarato/react-native-input-spinner#readme
// Definitions by: Manu Krishnan <https://github.com/mkrishnan-codes>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { Component } from 'react';
import { StyleProp, ViewStyle } from 'react-native';
export interface ReactNativeInputSpinnerProps {
type?: 'int' | 'float';
min?: string | number;
max?: string | number;
value?: string | number;
step?: string | number;
precision?: number;
rounded?: boolean;
activeOpacity?: number;
color?: string;
colorPress?: string;
colorRight?: string;
colorLeft?: string;
colorMax?: string;
colorMin?: string;
background?: string;
textColor?: string;
arrows?: boolean;
showBorder?: boolean;
fontSize?: number;
fontFamily?: string;
buttonFontSize?: number;
buttonFontFamily?: string;
buttonTextColor?: string;
disabled?: boolean;
editable?: boolean;
width?: string | number;
height?: string | number;
onChange?: (val?: any) => any;
onMin?: (val: any) => any;
onMax?: (val: any) => any;
onIncrease?: (val: any) => any;
onDecrease?: (val: any) => any;
buttonLeftDisabled?: boolean;
buttonRightDisabled?: boolean;
buttonLeftText?: string;
buttonRightText?: string;
buttonLeftImage?: React.ReactElement;
buttonRightImage?: React.ReactElement;
buttonPressLeftImage?: React.ReactElement;
buttonPressRightImage?: React.ReactElement;
buttonStyle?: StyleProp<ViewStyle>;
buttonPressStyle?: StyleProp<ViewStyle>;
inputStyle?: StyleProp<ViewStyle>;
style?: StyleProp<ViewStyle>;
append?: React.ReactElement;
prepend?: React.ReactElement;
}
export default class InputSpinner extends Component<ReactNativeInputSpinnerProps> { }

View File

@ -0,0 +1,18 @@
import * as React from 'react';
import InputSpinner from 'react-native-input-spinner';
class Example extends React.Component {
render() {
return (
<React.Fragment>
<InputSpinner
min={0}
max={50}
value={10}
step={5}
rounded={true}
/>
</React.Fragment>
);
}
}

View File

@ -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-input-spinner-tests.tsx"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }