@bezlepkin/nativescript-keyboard-opening
Nativescript 键盘打开管理器。
npm i --save @bezlepkin/nativescript-keyboard-opening

@bezlepkin/nativescript-keyboard-opening

一个插件,允许您跟踪键盘打开、变化、关闭并返回键盘高度。

npm install @bezlepkin/nativescript-keyboard-opening

用法

import { keyboardOpening } from '@bezlepkin/nativescript-keyboard-opening';

keyboardOpening().on('opened', async (args: any) => {
console.log('The keyboard is opened', args.data.height);
});

keyboardOpening().on('changed', async (args: any) => {
console.log('The keyboard is changed', args.data.height);
});

keyboardOpening().on('closed', async (args: any) => {
console.log('The keyboard is closed');
});

当您切换到另一个屏幕时停止跟踪,您需要取消订阅操作

keyboardOpening().off('opened');
keyboardOpening().off('changed');
keyboardOpening().off('closed');

许可证

Apache License 版本 2.0