KeyboardContext

KeyboardContext is provided by Channel. If you are not familiar with the React Context API, see the React docs.

Best Practices

  • Use useKeyboardContext for consistent access.
  • Call dismissKeyboard when 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 Channel children.

Basic Usage

Consume KeyboardContext in any child of Channel:

import { useContext } from "react";
import { KeyboardContext } from "stream-chat-react-native";

const { dismissKeyboard } = useContext(KeyboardContext);

Alternatively, use the useKeyboardContext hook.

import { useKeyboardContext } from "stream-chat-react-native";

const { dismissKeyboard } = useKeyboardContext();

Value

dismissKeyboard

Dismiss the keyboard.

Type
function