mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-13 05:20:25 +00:00
add typings for react-native-form (#35568)
* add typings for react-native-form * add typescript version * fix linting issues
This commit is contained in:
committed by
Ryan Cavanaugh
parent
43ddae1d7d
commit
9ce4bbcff8
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for react-native-form 2.1
|
||||
// Project: https://github.com/julianocomg/react-native-form#readme
|
||||
// Definitions by: Mark Nelissen <https://github.com/marknelissen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.4
|
||||
|
||||
import { Component } from 'react';
|
||||
import { ViewProps } from 'react-native';
|
||||
|
||||
export interface FormProps extends ViewProps {
|
||||
customFields?: {
|
||||
[key: string]: {
|
||||
callbackProp: string;
|
||||
controlled: boolean;
|
||||
valueProp: string;
|
||||
}
|
||||
};
|
||||
ref: string;
|
||||
}
|
||||
|
||||
export default class Form extends Component<FormProps> { }
|
||||
@@ -0,0 +1,22 @@
|
||||
import * as React from 'react';
|
||||
import Form from 'react-native-form';
|
||||
|
||||
function FormView() {
|
||||
return <Form ref="form"></Form>;
|
||||
}
|
||||
|
||||
const customFields = {
|
||||
RadioButtons: {
|
||||
controlled: true,
|
||||
valueProp: 'selectedOption',
|
||||
callbackProp: 'onSelection',
|
||||
}
|
||||
};
|
||||
|
||||
function FormViewWithCustomField() {
|
||||
return <Form ref="form" customFields={customFields}></Form>;
|
||||
}
|
||||
|
||||
function FormViewWithViewProps() {
|
||||
return <Form ref="form" style={{ flex: 1 }}></Form>;
|
||||
}
|
||||
@@ -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-form-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user