1

I just followed the answer from the link react-native: hide keyboard

But the keyboard is coming as flash for fraction of seconds then it is dismissing. Is there is a way to avoid keyboard totally.

asked Mar 8, 2017 at 13:12
2

3 Answers 3

2

This helped me:

import { Keyboard } from 'react-native'
// Hide that keyboard!
Keyboard.dismiss();
answered Sep 12, 2017 at 7:28
Sign up to request clarification or add additional context in comments.

Comments

1

Correct way is to dismiss View with TouchableWithoutFeedback and calling Keyboard.dismiss()

import {Keyboard} from 'react-native'
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
 <View style={styles.container}>
 <TextInput keyboardType='numeric'/>
 </View>
</TouchableWithoutFeedback>
answered Jul 21, 2017 at 6:11

Comments

0

You can use Keyboard.dismiss() for keyboard hide.

import React from "react";
import {
 Keyboard,
 StyleSheet,
 View,
 TextInput,
 TouchableOpacity
} from "react-native";
export default function App() {
 return (
 <TouchableOpacity onPress={() => Keyboard.dismiss()}>
 <View style={styles.MainContainer}>
 <TextInput
 style={styles.textinput}
 placeholder="Enter Your Name"
 />
 </View>
 </TouchableOpacity>
 );
}
const styles = StyleSheet.create({
 MainContainer: {
 flex: 1,
 justifyContent: "center",
 alignItems: "center"
 },
 text: {
 fontSize: 28,
 textAlign: "center"
 },
 textinput: {
 paddingVertical: 12,
 margin: 8,
 borderRadius: 7,
 backgroundColor: "#F9FBE7",
 borderWidth: 2,
 borderColor: "#000000",
 textAlign: "center"
 }
});
answered Jul 5, 2022 at 8:13

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.