import { useContext } from "react";
import { KeyboardContext } from "stream-chat-react-native";
const { dismissKeyboard } = useContext(KeyboardContext);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();Values
| Value | Description | Type |
|---|---|---|
dismissKeyboard | Dismiss the keyboard. | function |