diff --git a/demoApp/App.js b/demoApp/App.js index 74495fe..212891c 100644 --- a/demoApp/App.js +++ b/demoApp/App.js @@ -1,4 +1,4 @@ -import React, {Component} from 'react'; +import React, {Component, Fragment} from 'react'; import { Button, View, @@ -32,6 +32,10 @@ export default class App extends Component { type: 'day', value: '', }, + birthday_year: { + type: 'year', + value: '', + }, state: { type: 'state', value: '', @@ -116,15 +120,16 @@ export default class App extends Component { {this.renderError('last_name')} - { - this.setInputPosition({ - ids: ['birthday_month', 'birthday_day'], - value: nativeEvent.layout.y, - }); - }}> + Birthday? - + { + this.setInputPosition({ + ids: ['birthday_month', 'birthday_day'], + value: nativeEvent.layout.y, + }); + }} + style={styles.split}> - + { + this.setInputPosition({ + ids: ['birthday_year'], + value: nativeEvent.layout.y, + }); + }}> + { + this.onInputChange({id: 'birthday_year', value}); + }} + /> + {this.renderError('birthday_year')} + + { diff --git a/demoApp/validation/dictionary.js b/demoApp/validation/dictionary.js index f167b8c..8385803 100644 --- a/demoApp/validation/dictionary.js +++ b/demoApp/validation/dictionary.js @@ -144,6 +144,18 @@ export const validationDictionary = { }, }, + year: { + presence: { + allowEmpty: false, + message: '^This is required', + }, + numericality: { + greaterThan: 1900, + lessThanOrEqualTo: new Date().getFullYear(), + message: '^Must be valid', + }, + }, + zip: { presence: { allowEmpty: false,