Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native TextInput value is not working

Tags:

react-native

I have something like this:

<TextInput
  style={{height: 40, borderColor: 'gray', borderWidth: 1}}
  value={0}
  onChangeText={(input) => this.setState({ value: input })}
/>

However, the input box is always empty after load, any ideas?

like image 596
Brian Law Avatar asked Dec 11 '22 09:12

Brian Law


1 Answers

TextInput component only accept strings. Looks like you have a integer there. Try changing that to a string. Heres a link to the doc.

like image 60
Harshana Avatar answered Dec 28 '22 07:12

Harshana