UNPKG

house-middleware-sdk

Version:

58 hosue rn native sdk

54 lines (49 loc) 1.31 kB
/* * @method showToast 展示toast */ import { NativeModules } from 'react-native'; export function showToast(param, delay) { if (!param) { console.error("param不能为空"); return; } if (typeof param !== "string") { console.error("param应该为string类型"); return; } if (!delay) { delay = 1; } if (typeof delay !== "number") { console.error("delay应该为number类型"); return; } if (delay <= 0) { console.error("delay应该为大于0的整数"); return; } require("../utils/findImpl") .default( () => showToastWbImpl(param, delay), () => showToastAjkImpl(param, delay), () => showToastYdjjrImpl(param, delay), () => showToastWbtzImpl(param, delay) ); } function showToastWbImpl(param, delay) { const params = { message: param, time: delay, }; require("@w/wbapp").toast(params); } function showToastAjkImpl(param, delay) { require("ajkapp").showToast(param, delay); } function showToastYdjjrImpl(param, delay) { NativeModules.BrokerToast.showMessage(param); } //TODO:{58同镇 showToast 吐司...} function showToastWbtzImpl(param, delay) { showToastWbImpl(param, delay) }