react final form listeners
v1.0.3
? React最終表單聽眾是一個有用組件的集合,用於聆聽A中的字段?反應最終形式。
npm install --save react-final-form-listeners react-final-form final-form或者
yarn add react-final-form-listeners react-final-form final-form import { Form , Field } from 'react-final-form'
import { OnChange } from 'react-final-form-listeners'
const MyForm = ( ) => (
< Form
onSubmit = { onSubmit }
render = { ( { handleSubmit , pristine , invalid } ) => (
< form onSubmit = { handleSubmit } >
< div >
< label >
< Field name = "foo" component = "input" type = "checkbox" /> Turn foo on?
</ label >
< OnChange name = "foo" >
{ ( value , previous ) => {
// do something
} }
</ OnChange >
</ div >
...
</ form >
) }
/>
) ExternallyChangedname : Stringchildren: (externallyChanged: boolean) => React.NodeOnBlurname : Stringchildren: () => voidOnChangename : Stringchildren: (value: any, previous: any) => voidOnFocusname : Stringchildren: () => void 以下可以從react-final-form-listeners中進口。
ExternallyChanged當指定的字段最後在外部更新時(在不活動時更改)時,渲染器是帶有boolean標誌的渲染道具。
name : String聆聽的字段名稱。
children: (externallyChanged: boolean) => React.Node給定布爾國旗的渲染道具。
OnChange每當指定的字段更改時,請致電其children回調。它什麼都沒有。
name : String聆聽的字段名稱。
children: (value: any, previous: any) => void每當更改指定字段時,都會調用一個函數。它通過了新值和上一個值。
OnFocus每當指定的字段變得活躍時,請致電其children回調。它什麼都沒有。
name : String聆聽的字段名稱。
children: () => void每當更改指定字段時,都會調用一個函數。它通過了新值和上一個值。
OnBlur每當指定的字段模糊時,請致電其children回調。它什麼都沒有。
name : String聆聽的字段名稱。
children: () => void每當指定字段模糊時都會調用一個函數。