@hyext-beyond/hy-ui-native
Version:
A native lib polyfill for huya miniapp
25 lines • 731 B
JavaScript
export function showInputBar(props) {
return new Promise(function (resolve, reject) {
var _global$hyExt;
// @ts-expect-error
var api = (_global$hyExt = global.hyExt) == null || (_global$hyExt = _global$hyExt.ui) == null ? void 0 : _global$hyExt.showNativeInputBar;
if (api != null) {
api({
text: props.text,
placeholder: props.placeholder,
btnText: props.btnText || '完成'
}).then(function (res) {
resolve(res);
})["catch"](function (e) {
console.log("sdk input err", e.message);
reject(e);
});
} else {
console.log("sdk input not supported");
resolve({
text: ''
});
}
});
}
export default showInputBar;