React Native TextInput 值不起作用

Bri*_*Law 4 react-native

我有这样的事情:

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

但是,加载后输入框总是空的,有什么想法吗?

Har*_*tne 12

TextInput 组件只接受字符串。看起来你有一个整数。尝试将其更改为字符串。这是文档的链接