3.5.3 自定义模态框

ModalBox :自定义模态框组件(根据自己的业务需求去实现)

import React, {Component} from 'react';
import RootSiblings from 'react-native-root-siblings';
import ModalBox from '../components/ModalBox';

let elements = {};

//自定义模态框
const ModalBoxShow={
    show() { // 外界传入view
        let modalBox=new RootSiblings(<ModalBox  />)
        if(elements[key]){elements[key].destroy()}
        elements[key]=modalBox;
    },
    hide(key){
        elements[key] && elements[key].destroy();
    },
}

//一次取消所有模态框
export function cancelAllModalBox(){
    for(let key in elements){elements[key] && elements[key].destroy();}
}

module.exports={
    ModalBoxShow,
    cancelAllModalBox,
};
该文件修订时间: 2021-01-14 15:02:10

results matching ""

    No results matching ""