react-native call onSubmit() when pressed returnKeyType

偶尔善良 提交于 2019-12-12 16:14:26

问题


I'm new to react-native.

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?


回答1:


You can use onSubmitEditing callback of TextInput

Example.

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

You can get more information from docs



来源:https://stackoverflow.com/questions/41421222/react-native-call-onsubmit-when-pressed-returnkeytype

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!