Package Exports
- redux-form-normalize
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (redux-form-normalize) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
redux-form-normalize
Description
A small library for strings normalizing in redux-form
Installation
npm i redux-form-normalize
or
yarn add redux-form-normalize
Usage
import React, { Component } from 'react'
import { Field, reduxForm } from 'redux-form'
import { normalize } from 'redux-form-normalize'
class ExampleForm extends Component {
submit = (values, dispatch) => {
dispatch({
type: 'EXAMPLE_REQUEST',
payload: {}
})
}
render() {
const { handleSubmit } = this.props
return (
<form onSubmit={handleSubmit(this.submit)}>
<div className="g-auth__tab">
<div className="g-field__wrapper">
<Field
name="username"
component="input"
type="text"
placeholder="Username"
normalize={normalize.float(2)}
/>
</div>
</div>
<div>
<button type="submit">
SUBMIT
</button>
<button type="button">
BACK
</button>
</div>
</form>
)
}
}
export default reduxForm({
form: 'exampleForm'
})(ExampleForm)
Methods
Method | Description |
---|---|
[integer(x) ] |
x - amount of numbers |
[float(x) ] |
x - amount of decimal places |
[currency(x) ] |
x - currency symbol (for example - 'USD') |
[phone ] |
- U.S. phone number |