Ionic + Reactjs,无法处理onChange TextField材质用户界面

时间:2019-11-11 17:11:24

标签: reactjs typescript ionic-framework

我不能用超过1个字符填充此字段。如果我尝试填充并且总是在1个字符后停止

form.js

const [ referral,setReferral] = useState('');
...
<CssTextField
    className={classes.textField}
    label="Referral"
    variant="outlined"
    name="referral"
    id="custom-css-outlined-input"
    InputProps={{
        style: {
            border : borderColorReferral,
            borderRadius : "0px 10px 10px 0px"
        },
        onChange : (e) => {setReferral(e.target.value)},
        value : referral
    }}
    InputLabelProps={{
        style : {
            color:colorReferral,
            padding:"0px 6px"
        }
    }}
/>

Before

after

1 个答案:

答案 0 :(得分:0)

Ionic直接使用onIonChange而不是onChange,因此您需要确保正确映射这些事件