https://github.com/jcoreio/redux-form-normalize-on-blur
a redux-form Field component that supports a normalizeOnBlur property
https://github.com/jcoreio/redux-form-normalize-on-blur
formatted-input normalize react redux-form
Last synced: 6 months ago
JSON representation
a redux-form Field component that supports a normalizeOnBlur property
- Host: GitHub
- URL: https://github.com/jcoreio/redux-form-normalize-on-blur
- Owner: jcoreio
- License: mit
- Created: 2018-01-12T20:57:48.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-05T23:17:38.000Z (about 1 year ago)
- Last Synced: 2024-11-10T10:48:43.849Z (6 months ago)
- Topics: formatted-input, normalize, react, redux-form
- Language: TypeScript
- Size: 4.15 MB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# redux-form-normalize-on-blur
[](https://travis-ci.org/jcoreio/redux-form-normalize-on-blur)
[](https://codecov.io/gh/jcoreio/redux-form-normalize-on-blur)
[](https://github.com/semantic-release/semantic-release)
[](http://commitizen.github.io/cz-cli/)
[](https://badge.fury.io/js/redux-form-normalize-on-blur)a `redux-form` `Field` component that supports a `normalizeOnBlur` property
# Usage
```sh
npm install --save redux-form-normalize-on-blur
``````js
const { Field } = require('redux-form-normalize-on-blur')
```or
```js
const { Field } = require('redux-form-normalize-on-blur/immutable')
```## Example
The following field will trim its text when it loses focus:
```js
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`!