我遇到一个非常简单的问题.我有用户名,密码和按钮的登录表单.在我的按钮处理程序中,我尝试获取textinput值.但总是得到未定义的价值.我错过了什么吗?
render() { <ExScreen headerColor={this.state.headerColor} scrollEnabled={this.state.enableScroll} style={styles.container} > <View > <View > <View style={[styles.inputContainer]} > <TextInput ref= "username" onChangeText={(text) => this.setState({text})} value={this.state.username} /> </View> <Button style={{color: 'white',marginTop: 30,borderWidth: 1,borderColor: 'white',marginLeft: 20*vw,marginRight: 20*vw,height: 40,padding: 10}} onPress={this._handlePress.bind(this)}> Sign In </Button> ... _handlePress(event) { var username=this.refs.username.value;