mochixuan / react-native-smart-tip

🔥🔥🔥Toast , SnackBar , Modal , Show Toast above Modal
248 stars 37 forks source link

请问 WModal 有没有关闭的 api? #2

Closed ryuusennka closed 5 years ago

ryuusennka commented 5 years ago
const load1 = WModal.show({
        data: '加载中',
        textColor: '#fff',
        backgroundColor: '#444444',
        position: WModal.position.CENTER,
        icon: <ActivityIndicator color="#fff" size={'large'} />,
});
console.log(load1);// undefined 这里是 undefined

show 了以后不知道怎么关闭.

mochixuan commented 5 years ago

这个是model,功能是可以显示在其他model上,还可以做数据加载时loading现在,有个hide方法demo里面有。

---原始邮件--- 发件人: "ryuusennka"notifications@github.com 发送时间: 2019年7月4日(星期四) 下午4:51 收件人: "mochixuan/react-native-smart-tip"react-native-smart-tip@noreply.github.com; 抄送: "Subscribed"subscribed@noreply.github.com; 主题: [mochixuan/react-native-smart-tip] 请问 WModal 有没有关闭的 api? (#2)

const load1 = WModal.show({ data: '加载中', textColor: '#fff', backgroundColor: '#444444', position: WModal.position.CENTER, icon: <ActivityIndicator color="#fff" size={'large'} />, }); console.log(load1);// undefined 这里是 undefined

show 了以后不知道怎么关闭.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

mochixuan commented 5 years ago

show = (toastOpts) => {

    if (this.testTimeOut) {
        clearTimeout(this.testTimeOut)
        this.testTimeOut = undefined
        ModalToast.hide()
    }

    ModalToast.show(toastOpts)

    // 隐藏
    this.testTimeOut = setTimeout(()=>{
        ModalToast.hide()
    },3000)
}

WModal方法使用的是Modal为最外层。三个方法都采用全局唯一,防止遮盖现象。