File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ This repository is a set of high order components designed to help you take cont
1616
1717- [ Installation] ( #installation )
1818- [ Advanced Example] ( #advanced-example )
19+ - [ Formatting inputs] ( #formatting-inputs )
1920- [ API] ( #api )
2021 - [ makeReactNativeField] ( #makereactnativefield )
2122 - [ setFormikInitialValue] ( #setFormikInitialValue )
@@ -185,6 +186,27 @@ export default props => (
185186);
186187```
187188
189+ ## Formatting inputs
190+
191+ 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 ` ).
192+ Here's how you would do it:
193+
194+ ``` javascript
195+ const formatPhoneNumber: string = > string = (unformattedPhoneNumber ) => ... ;
196+
197+ ...
198+
199+ < Formik
200+ render= {({ values }) => {
201+ return (
202+ < Form>
203+ < MyInput name= " phoneNumber" value= {formatPhoneNumber (values .phoneNumber )} / >
204+ < / Form>
205+ );
206+ }}
207+ / >
208+ ```
209+
188210## API
189211
190212### makeReactNativeField
You can’t perform that action at this time.
0 commit comments