redux-form-normalize-on-blur
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

redux-form-normalize-on-blur

Build Status Coverage Status semantic-release Commitizen friendly npm version

a redux-form Field component that supports a normalizeOnBlur property

Usage

npm install --save redux-form-normalize-on-blur
const { Field } = require('redux-form-normalize-on-blur')

or

const { Field } = require('redux-form-normalize-on-blur/immutable')

Example

The following field will trim its text when it loses focus:

<Field
  name="name"
  normalizeOnBlur={(value) => value && value.trim()}
  component={YourInputComponent}
/>

API

Field

Has the same API as redux-form's Field, but it accepts an additional normalizeOnBlur property:

normalizeOnBlur?: (value: any) => any

Function that takes the current value and returns the normalized value. NOTE: this happens before parse or normalize!

Package Sidebar

Install

npm i redux-form-normalize-on-blur

Weekly Downloads

657

Version

1.1.0

License

MIT

Unpacked Size

19.8 kB

Total Files

19

Last publish

Collaborators

  • jedwards1211