@@ -14,6 +14,7 @@ export default class TextFieldScreen extends Component {
1414 state = {
1515 errorPosition : TextField . validationMessagePositions . TOP ,
1616 shouldDisable : false ,
17+ isReadonly : false ,
1718 value : 'Initial Value' ,
1819 searching : false ,
1920 preset : 'withUnderline'
@@ -50,7 +51,7 @@ export default class TextFieldScreen extends Component {
5051 }
5152
5253 render ( ) {
53- const { errorPosition, shouldDisable, price, preset} = this . state ;
54+ const { errorPosition, shouldDisable, isReadonly , price, preset} = this . state ;
5455 return (
5556 < ScrollView keyboardShouldPersistTaps = "always" >
5657 < View flex padding-page >
@@ -182,11 +183,19 @@ export default class TextFieldScreen extends Component {
182183 < Text h3 blue50 marginV-s4 >
183184 Colors By State
184185 </ Text >
185- < Button
186- label = { shouldDisable ? 'Enable' : 'Disable' }
187- onPress = { ( ) => this . setState ( { shouldDisable : ! shouldDisable } ) }
188- size = { Button . sizes . xSmall }
189- />
186+ < View row >
187+ < Button
188+ label = { isReadonly ? 'Enable' : 'Readonly' }
189+ onPress = { ( ) => this . setState ( { isReadonly : ! isReadonly } ) }
190+ size = { Button . sizes . xSmall }
191+ marginR-s4
192+ />
193+ < Button
194+ label = { shouldDisable ? 'Enable' : 'Disable' }
195+ onPress = { ( ) => this . setState ( { shouldDisable : ! shouldDisable } ) }
196+ size = { Button . sizes . xSmall }
197+ />
198+ </ View >
190199 </ View >
191200
192201 < TextField
@@ -195,14 +204,16 @@ export default class TextFieldScreen extends Component {
195204 default : Colors . $textDefault ,
196205 focus : Colors . $textGeneral ,
197206 error : Colors . $textDangerLight ,
198- disabled : Colors . $textDisabled
207+ disabled : Colors . $textDisabled ,
208+ readonly : Colors . $textNeutral
199209 } }
200210 placeholder = "Enter valid email"
201211 validationMessage = "Email is invalid"
202212 validate = { 'email' }
203213 validateOnChange
204214 fieldStyle = { styles . withFrame }
205215 editable = { ! shouldDisable }
216+ readonly = { isReadonly }
206217 />
207218
208219 < View row spread centerV >
@@ -224,6 +235,7 @@ export default class TextFieldScreen extends Component {
224235 preset === 'withUnderline' ? styles . withUnderline : styles . withFrame
225236 }
226237 editable = { ! shouldDisable }
238+ readonly = { isReadonly }
227239 />
228240
229241 < Text h3 blue50 marginV-s4 >
0 commit comments