1- import React , { Component } from 'react' ;
1+ import React , { Component , Fragment } from 'react' ;
22import {
33 Button ,
44 View ,
@@ -32,6 +32,10 @@ export default class App extends Component {
3232 type : 'day' ,
3333 value : '' ,
3434 } ,
35+ birthday_year : {
36+ type : 'year' ,
37+ value : '' ,
38+ } ,
3539 state : {
3640 type : 'state' ,
3741 value : '' ,
@@ -116,15 +120,16 @@ export default class App extends Component {
116120 { this . renderError ( 'last_name' ) }
117121 </ View >
118122
119- < View
120- onLayout = { ( { nativeEvent} ) => {
121- this . setInputPosition ( {
122- ids : [ 'birthday_month' , 'birthday_day' ] ,
123- value : nativeEvent . layout . y ,
124- } ) ;
125- } } >
123+ < Fragment >
126124 < Text > Birthday?</ Text >
127- < View style = { styles . split } >
125+ < View
126+ onLayout = { ( { nativeEvent} ) => {
127+ this . setInputPosition ( {
128+ ids : [ 'birthday_month' , 'birthday_day' ] ,
129+ value : nativeEvent . layout . y ,
130+ } ) ;
131+ } }
132+ style = { styles . split } >
128133 < View style = { { flex : 1 , marginRight : 5 } } >
129134 < TextInput
130135 style = { styles . input }
@@ -146,7 +151,23 @@ export default class App extends Component {
146151 { this . renderError ( 'birthday_day' ) }
147152 </ View >
148153 </ View >
149- </ View >
154+ < View
155+ onLayout = { ( { nativeEvent} ) => {
156+ this . setInputPosition ( {
157+ ids : [ 'birthday_year' ] ,
158+ value : nativeEvent . layout . y ,
159+ } ) ;
160+ } } >
161+ < TextInput
162+ style = { styles . input }
163+ placeholder = "Year"
164+ onChangeText = { value => {
165+ this . onInputChange ( { id : 'birthday_year' , value} ) ;
166+ } }
167+ />
168+ { this . renderError ( 'birthday_year' ) }
169+ </ View >
170+ </ Fragment >
150171
151172 < View
152173 onLayout = { ( { nativeEvent} ) => {
0 commit comments