1.1.0 • Published 2 years ago
redux-form-normalize-on-blur v1.1.0
redux-form-normalize-on-blur
a redux-form Field component that supports a normalizeOnBlur property
Usage
npm install --save redux-form-normalize-on-blurconst { 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!