【发布时间】:2019-04-03 18:00:57
【问题描述】:
下面是我的登录类代码:
export default class Login extends Component {
constructor(props) {
super(props);
this.state = {
loggedIn: true,
}
handlePress = () => {
this.props.onHomeviewPress(this.state.data);
}
}
render() {
return (
<View style={styles.container}>
<Text style={{ color: "blue", fontSize: 28, marginLeft: 10 }}> Login</Text>
<TextInput style={styles.input}
underlineColorAndroid="transparent"
placeholder="Email"
placeholderTextColor="blue"
autoCapitalize="none"
/>
<TextInput style={styles.input}
underlineColorAndroid="transparent"
placeholder="Password"
placeholderTextColor="blue"
autoCapitalize="none"
/>
<Button
onPress={() => this.handlePress.bind(this)}
title="Login"
/>
</View>
);
}
}
HANDLEPRESS 功能有问题无法正常工作并给出错误
undefined 不是对象('_this2.handlepress.bind')
请帮我解决这个问题。提前致谢
【问题讨论】:
标签: react-native