Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to manually dismiss the keyboard? #647

operate2v opened this issue Nov 23, 2017 · 8 comments

Is there a way to manually dismiss the keyboard? #647

operate2v opened this issue Nov 23, 2017 · 8 comments


Copy link

@operate2v operate2v commented Nov 23, 2017

Is there a way to manually dismiss the keyboard?
For example, if you type certain text, the keyboard dismisses.

  • React Native version: 0.49.3
  • react-native-gifted-chat version: latest
  • Platform(s) (iOS, Android, or both?): both
Copy link

@ownikss ownikss commented Dec 1, 2017

import dismissKeyboard from 'dismissKeyboard';

// for dismiss keyboard on your event:

Copy link

@leonel-lordford leonel-lordford commented Dec 11, 2017

Worked excellent !!!

Copy link

@xcarpentier xcarpentier commented Dec 21, 2017

I close this issue but create a FAQ in readme to refer it:

Copy link

@PolThm PolThm commented Feb 14, 2020

Sorry I don't understand where to put "import dismissKeyboard from 'dismissKeyboard';" and "dismissKeyboard();", can you help me please ?

Copy link

@ownikss ownikss commented Feb 15, 2020

You should use module Keyboard from react-native to hide keyboard.

import { Keyboard } from 'react-native';

Copy link

@PolThm PolThm commented Feb 18, 2020

Thank your for your response !

My research was finally "how to remove the keyboard", and I've finally succeeded with those 2 lines in the props :
renderInputToolbar={() => {}}

I've another question (sorry I don't know where else to post it) :
Is there a way to pass a function when I press the screen (because if I put a as parent it doesn't scroll anymore).

Thank you !

Copy link

@kerubkim kerubkim commented Jun 18, 2020

How did you guys detect user when pressing out of the textinput?
I noticed on android the keyboard stays even when I tried pressing out

Copy link

@ownikss ownikss commented Jun 19, 2020

@kerubkim, I'm not sure that you need detect press out of textinput. If you want to hide keyboard on tap on scrollview, you can use keyboardShouldPersistTaps='never' ScrollView prop.

If you really want to handle click out of input, you can try onStartShouldSetResponderCapture prop for view. Add it to some root view, and function will be triggered on every screen touch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.