Reputation: 1
When I used onSubmitEditing in TextInput and pressed submit button than I found an undefined result in the console onChangeText worked but I want to put onSubmitEditing
<View>
<Text>Name of Industry </Text>
<TextInput
placeholder='Your Answer'
onSubmitEditing={txtHandler1}
/>
</View>
Upvotes: 0
Views: 295
Reputation: 53
onSubmitEditing
is called when the text input's submit button is pressed. The submit button can be return key or can be different based on returnKeyType
props or vice versa. I am not sure what you want to do?
You should send the text value to the txtHandler1
<View>
<Text>Name of Industry </Text>
<TextInput
placeholder='Your Answer'
onSubmitEditing={(event)=> txtHandler1(event.nativeEvent.text)}
/>
</View>
You can also use onEndEditing
props instead of onSubmitEditing
which will called when text input ends.
onEndEditing={(event)=> txtHandler1(event.nativeEvent.text)}
Upvotes: 1