gpt4 book ai didi

reactjs - react native 自定义 TextInput onchangeText 不起作用

转载 作者:行者123 更新时间:2023-12-03 14:09:06 26 4
gpt4 key购买 nike

这是我的模板代码

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 };

最佳答案

根据您的问题和评论,我认为您传递了错误的属性。将您的登录表单更改为:

<InputT 
label= "Team Size"
placeholder= "eg:10"
value = {this.state.teamsize}
ipOnChangeText = {teamsize => this.setState({ teamsize })}
/>

请注意我如何将 onChangeText 更改为 ipOnChangeText,这是您的 InputT 组件期望的属性名称

关于reactjs - react native 自定义 TextInput onchangeText 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45982610/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com