i am using number-pad keyboard in react-native, i want to hide the keyboard when click on done button,for that i want to add done button above the keyboard, is there any possibility like IOS apps to hide the keyboard, Any help much appreciated
returnKeyType is the right way to do this, on Android you can use returnKeyLabel , as mentioned (here)[facebook.github.io/react-native/docs/textinput#returnkeytype] If it is now showing the next button even you are using the right prop, you need to share your code sample, so that I can see for the issue.
I'm not sure if this is exactly what you want, but you can add a 'done' button to the keyboard using the prop returnKeyType.
E.g: returnKeyType={ 'done' }
More info here https://facebook.github.io/react-native/docs/textinput.html#returnkeytype
Using React Native v.63
in 2021
returnKeyType='done'
it will automatically hide the keyboard
onSubmitEditing={() => yourFunctionNameHere()}
This worked for me =>
<TextInput
style={styles.textBox}
maxLength={5}
placeholder="Enter Zip Code"
placeholderTextColor={'#6D7376'}
autoCompleteType="postal-code"
keyboardType="number-pad"
returnKeyType="done"
onChangeText={text => setZip(text)}
onSubmitEditing={() => yourFunctionNameHere()}
/>
here is the direct documentation https://reactnative.dev/docs/textinput#returnkeytype
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With