提交 b1e03a7e 编写于 作者: Q qiang

chore: build

上级 3f1132e3
......@@ -19480,8 +19480,63 @@ function clearTempFile() {
});
}
let focusTimeout = 0;
let keyboardHeight = 0;
let onKeyboardShow = null;
let focusTimer = null;
function hookKeyboardEvent(event, callback) {
onKeyboardShow = null;
if (focusTimer) {
clearTimeout(focusTimer);
focusTimer = null;
}
if (event.type === 'onFocus') {
if (keyboardHeight > 0) {
event.detail.height = keyboardHeight;
}
else {
focusTimer = setTimeout(function () {
event.detail.height = keyboardHeight;
callback(event);
}, focusTimeout);
onKeyboardShow = function () {
if (focusTimer) {
clearTimeout(focusTimer);
focusTimer = null;
}
event.detail.height = keyboardHeight;
callback(event);
};
return;
}
}
callback(event);
}
function initKeyboardEvent() {
const isAndroid = plus.os.name.toLowerCase() === 'android';
focusTimeout = isAndroid ? 300 : 700;
UniServiceJSBridge.on(ON_KEYBOARD_HEIGHT_CHANGE, (res) => {
keyboardHeight = res.height;
if (keyboardHeight > 0) {
const callback = onKeyboardShow;
onKeyboardShow = null;
if (callback) {
callback();
}
}
});
}
function onNodeEvent(nodeId, evt, pageNode) {
pageNode.fireEvent(nodeId, evt);
const type = evt.type;
if (type === 'onFocus' || type === 'onBlur') {
hookKeyboardEvent(evt, evt => {
pageNode.fireEvent(nodeId, evt);
});
}
else {
pageNode.fireEvent(nodeId, evt);
}
}
function onVdSync(actions, pageId) {
......@@ -19745,6 +19800,7 @@ function registerApp(appVm) {
initEntry();
initTabBar();
initGlobalEvent();
initKeyboardEvent();
initSubscribeHandlers();
initAppLaunch(appVm);
// 10s后清理临时文件
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册