美文网首页
rn-global-modal 弹窗组件

rn-global-modal 弹窗组件

作者: 金丝楠 | 来源:发表于2019-10-21 15:52 被阅读0次

实现全局弹窗,推荐使用rn-global-modal第三方组件。

animationType可以配置动画效果
<EntrustAlert />自定义弹窗内容
callbackIndex点击后回调参数

具体代码如下

import Modal from "rn-global-modal";

  onMeltOut = () => {
    Modal.show(
      <EntrustAlert
        callbackIndex={index => {
          if (index === 1) {
            Modal.hide();
          } else {
            Modal.hide();
          }
        }}
      />,
      {
        animationType: "fade",
        maskClosable: true,
        onMaskClose: () => {}
      }
    );
  };

  renderMeltOutButton = () => {
    return (
      <View style={styles.validityView}>
        <TouchableOpacity onPress={this.onMeltOut}>
          <Image
            source={SECURITY_MELT_OUT_IMAGE}
            style={styles.meltOutButton}
          />
        </TouchableOpacity>
      </View>
    );
  };

相关文章

网友评论

      本文标题:rn-global-modal 弹窗组件

      本文链接:https://www.haomeiwen.com/subject/novtvctx.html