---
name: "onKeyboardWillHide"
mode: "kit"
versionRequirements:
  - { name: "BaseKit", version: "3.6.6" }
  - { name: "@ray-js/ray", version: "1.5.30" }
platform:
  - "iOS"
  - "Android"
async: true
title: "onKeyboardWillHide - Keyboard hidden event"
---

## onKeyboardWillHide

> [VERSION] BaseKit >= 3.6.6 | @ray-js/ray >= 1.5.30

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Keyboard message

### Parameters

`(listener: Function)`

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `listener` | `(params: KeyboardBeanRes) => void` | Yes | - |  |

### Referenced Types

##### `interface` KeyboardBeanRes

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `height` | `number` | `3.6.1` | Keyboard height |
| `keyBoardArea` | `KeyBoardArea` | `3.32.6` | Keyboard pop-up position |

##### `interface` KeyBoardArea

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `top` | `number` | `3.32.6` | Top position of the keyboard when shown |
| `bottom` | `number` | `3.32.6` | Bottom position of the keyboard when shown |
| `left` | `number` | `3.32.6` | Left position of the keyboard when shown |
| `right` | `number` | `3.32.6` | Right position of the keyboard when shown |


### Examples

#### Demo

```tsx
import { onKeyboardWillHide, scanCode } from '@ray-js/ray'

// Register the keyboard hide event and use scanCode's keyboard input mode to bring up and then hide the system keyboard.
// Passing isShowKeyboard: true: after entering the keyboard input page, the keyboard pops up automatically; tapping Back/Cancel to exit the input page hides the keyboard, triggering onKeyboardWillHide.
onKeyboardWillHide(e => {
  console.log("[onKeyboardWillHide]", e);
});

scanCode({
  onlyFromCamera: false,
  isShowKeyboard: true,
  keyboardBean: { title: "Keyboard input" },
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
