Skip to content

Commit

Permalink
docs: add formatting input example
Browse files Browse the repository at this point in the history
  • Loading branch information
Almouro committed Apr 3, 2018
1 parent f63433d commit a00e3eb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This repository is a set of high order components designed to help you take cont

- [Installation](#installation)
- [Advanced Example](#advanced-example)
- [Formatting inputs](#formatting-inputs)
- [API](#api)
- [makeReactNativeField](#makereactnativefield)
- [setFormikInitialValue](#setFormikInitialValue)
Expand Down Expand Up @@ -185,6 +186,26 @@ export default props => (
);
```

## Formatting inputs

You may need to format inputs as the user types in. For instance, adding spaces in a telephone number (`0612345678` -> `06 12 34 56 78`).

```javascript
const formatPhoneNumber: string => string = (unformattedPhoneNumber) => ...;

...

<Formik
render={({ values }) => {
return (
<Form>
<MyInput name="phoneNumber" value={formatPhoneNumber(values.phoneNumber)} />
</Form>
);
}}
/>
```

## API

### makeReactNativeField
Expand Down

0 comments on commit a00e3eb

Please sign in to comment.