更改值的状态时,不会触发TextInput onChange和onChangeText

问题描述

在我的应用程序中,我有一个这样定义的字符串值:

@H_404_2@if(is_page('home')){ //take decision }else{ //take decsion }

我也有const [otp,setotp] = React.useState<string>('') 定义为:

@H_404_2@TextInput

当我尝试<TextInput value={otp} onChange={ () => console.log('Text Input')} onChangeText={ (text) => console.log(`new text ${text}`)}/> 时,我发现setotp(newValue)中的值发生了变化,但是TextInputonChange()均未触发。

为什么会这样?我在这里做错什么了吗?如何获得这些回调?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)