当按下returnKeyType时,react-native调用onSubmit() [英] react-native call onSubmit() when pressed returnKeyType

查看:454
本文介绍了当按下returnKeyType时,react-native调用onSubmit()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是本机反应的新手.

I'm new to react-native.

我现在在键盘上苦苦挣扎.我有TextInput和一个按钮.我想要的是,当用户通过键盘输入输入时,他/她只需单击返回按钮就可以转到下一页.因此,我只想在用户单击键盘上的返回"按钮时调用onSubmit方法. 有没有人可以帮助我?

I'm struggling on keyboard now. I have TextInput and a button. What I want is that, when user entered input through keyboard, he/she can go to next page with just one click on the return button. So what I simply want is that onSubmit method should be called when user clicks "return" button on keyboard. Is there anyone can help me?

推荐答案

您可以使用TextInput

示例.

<TextInput
   onSubmitEditing={(event) => this.onSubmitHandler(event)}
/>

您可以从文档

这篇关于当按下returnKeyType时,react-native调用onSubmit()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆