React Native Textinput 不会在 iOS 上调用 onchange
我的反应本机应用程序有问题。我有简单的注释输入,它在 Android 上按预期工作,但在 iOS 上永远不会调用 onChange/onChangeText 方法。这很奇怪,因为我在输入中看到正确的值,但如果我在 onChange 方法中 console.log ,它永远不会被调用。我在这里缺少什么?
const [noteEdit, _setNoteEdit] = useState(note)
const noteRef = React.useRef(noteEdit);
const setNoteEdit = event => {
const note= event.nativeEvent.text;
_setNoteEdit(note);
noteRef.current = note;
}
<TextInput multiline={true}
value={noteEdit} onChange={setNoteEdit} autoCorrect={false} />
I have a problem with my react-native app. I have simple input for the note, it works as expected on Android, but on iOS onChange/onChangeText method is never called. It is weird because i see correct value in input, but if I console.log in onChange method, its never called. What am I missing here?
const [noteEdit, _setNoteEdit] = useState(note)
const noteRef = React.useRef(noteEdit);
const setNoteEdit = event => {
const note= event.nativeEvent.text;
_setNoteEdit(note);
noteRef.current = note;
}
<TextInput multiline={true}
value={noteEdit} onChange={setNoteEdit} autoCorrect={false} />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你需要尝试下面的方法希望它有效
you need to try this below hope it's working