这是我的模板代码
import React, {Component} from 'react';
import {TextInput, View, Text,} from 'react-native';
const InputT = ({ label , inputvalue, ipOnChangeText, placeholder , secureTextEntry}) => {
const {inputStyle, labelStyle, containerStyle} = styles;
return(
<View style = {containerStyle}>
<Text style= {labelStyle} >{label}</Text>
<TextInput
secureTextEntry={secureTextEntry}
autoCorrect={false}
placeholder={placeholder}
style= {inputStyle}
value = {inputvalue}
onChangeText = {ipOnChangeText}
/>
</View>
);
}
const styles ={
inputStyle:{
color: '#333',
fontSize: 16,
lineHeight: 23,
borderBottomColor: '#333',
borderBottomWidth: 0.5,
fontFamily: 'System',
},
labelStyle:{
fontSize: 18,
color: '#737373',
paddingBottom: 10,
fontFamily: 'System',
},
containerStyle:{
flexDirection: 'column',
marginTop: 10,
marginBottom: 10
}
}
export { InputT };
答案 0 :(得分:3)
根据您的问题和您的评论,我认为您传递了错误的财产。将您的登录表单更改为:
<InputT
label= "Team Size"
placeholder= "eg:10"
value = {this.state.teamsize}
ipOnChangeText = {teamsize => this.setState({ teamsize })}
/>
注意我如何更改onChangeText
ipOnChangeText
InputT
,这是this.elementRef.nativeElement.appendChild(s);
组件所期望的属性的名称