react-native call onSubmit() when pressed returnKeyType
Asked Answered
A

1

6

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?

Autosome answered 2/1, 2017 at 4:4 Comment(0)
P
14

You can use onSubmitEditing callback of TextInput

Example.

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

You can get more information from docs

Preglacial answered 2/1, 2017 at 4:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.