export default class SignUp extends Component {
render() {
const {Username, Password, signUpSuccessful} = this.state
return (
<KeyboardAvoidingView behavior = 'padding' style = {styles.container}>
<TextInput
style = {styles.textInput}
placeholder = "Username"
onChangeText = {this.UpdateUsername}
//maxLength = {20}
value = {this.state.Username.value}
/>
<TextInput
style = {styles.textInput}
placeholder = "Password"
onChangeText = {this.UpdatePassword}
maxLength = {20}
value = {this.state.Password.value}
/>我刚开始使用react-native,并不真正了解TextInput是如何工作的,有人能告诉我为什么我无法在TextInput字段中输入内容吗?
我正在尝试创建一个登录页面来存储用户的用户名和密码在一个firebase数据库中,存储的代码还没有创建。我正在尝试让我的TextInput字段首先正常工作。在我为它们添加value行之前,它可以工作得更早,但现在注释掉它们并不能使它们返回到可用的状态,所以我怀疑错误可能来自代码的其他方面,但我不确定问题出在哪里,因为到目前为止,代码非常简单。
如果您需要查看代码的其他部分,请让我知道,因为这只是它的一小部分。
发布于 2020-05-25 02:09:48
为了解决这个问题,是KeyboardAvoidingView导致了问题,虽然不确定为什么,但现在只需要使用View。
https://stackoverflow.com/questions/61983678
复制相似问题