import { useContext } from "react";
import { KeyboardContext } from "stream-chat-react-native";
const { dismissKeyboard } = useContext(KeyboardContext);This is documentation for Stream Chat React Native SDK v8, which is no longer actively maintained. For up-to-date documentation, see the latest version (v9).
KeyboardContext
KeyboardContext is provided by Channel. If you are not familiar with the React Context API, see the React docs.
Best Practices
- Use
useKeyboardContextfor consistent access. - Call
dismissKeyboardwhen opening full-screen pickers or overlays. - Avoid frequent keyboard dismiss calls that interrupt typing.
- Keep keyboard handling centralized to prevent conflicting behaviors.
- Use this context only within
Channelchildren.
Basic Usage
Consume KeyboardContext in any child of Channel:
Alternatively, use the useKeyboardContext hook.
import { useKeyboardContext } from "stream-chat-react-native";
const { dismissKeyboard } = useKeyboardContext();Value
dismissKeyboard
Dismiss the keyboard.
| Type |
|---|
| function |