微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

react-native-keyboardevents

程序名称:react-native-keyboardevents

授权协议: MIT

操作系统: iOS

开发语言: Objective-C

react-native-keyboardevents 介绍

react-native-keyboardevents 是 React
Native
键盘事件。

基础示例:

// require the module
var KeyboardEvents = require('react-native-keyboardevents');

// Now get a handle on the event emitter and add your callbacks
// to the desired events.
var KeyboardEventEmitter = KeyboardEvents.Emitter;

// Each event will receive a `frames` object, which contains three keys -
// `begin`,  `end`, and `duration` . The `begin` and `end`  keys each
// contain an object describing the bounds of the keyboard (x, y, width
// and height). The `duration` key contains the length of the keyboard
// animation in seconds.
// The frame in `begin` describes the bounds of the keyboard before the
// animation occurred and the frame in `end` describes the bounds the keyboard
// will have, after the animation has completed.
KeyboardEventEmitter.on(KeyboardEvents.KeyboardWillShowEvent, (frames) => {
  console.log('will show', frames);
});
KeyboardEventEmitter.on(KeyboardEvents.KeyboardDidShowEvent, (frames) => {
  console.log('did show', frames);
});
KeyboardEventEmitter.on(KeyboardEvents.KeyboardWillHideEvent, (frames) => {
  console.log('will hide', frames);
});
KeyboardEventEmitter.on(KeyboardEvents.KeyboardDidHideEvent, (frames) => {
  console.log('did hide', frames);
});
KeyboardEventEmitter.on(KeyboardEvents.KeyboardWillChangeFrame, (frames) => {
  console.log('will change', frames);
});
KeyboardEventEmitter.on(KeyboardEvents.KeyboardDidChangeFrame, (frames) => {
  console.log('did change', frames);
});

react-native-keyboardevents 官网

https://github.com/johanneslumpe/react-native-keyboardevents

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐