【发布时间】:2019-08-21 07:15:08
【问题描述】:
当我尝试在我的代码中创建可重用组件时,它显示了一些错误。
下面是我的代码
登录.js
render() {
return (
<View style={login.container}>
<Image source={imageLogo} style={login.logo} />
<View style={login.form}>
<ApptiTextInput
value={this.state.email}
onChangeText={this.handleEmailChange}
placeholder={strings.EMAIL_PLACEHOLDER}
/>
<ApptiTextInput
value={this.state.password}
onChangeText={this.handlePasswordChange}
placeholder={strings.PASSWORD_PLACEHOLDER}
/>
<ApptiButton label={strings.LOGIN} handleLoginPress={this.handleLoginPress.bind(this)} />
</View>
</View>
);
}
Apptibutton.js
render() {
const { label, handleLoginPress } = this.props;
console.log(label);
return (
<View style={apptiButton.container}>
<TouchableOptacity onPress={handleLoginPress}>
<Text style={apptiButton.text} >{label}</Text>
</TouchableOptacity>
</View>
);
}
【问题讨论】:
-
能否请您发送整个代码
-
我在上面添加了我的代码作为驱动链接
标签: react-native