Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

rat-overlay

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rat-overlay

rat-overlay component for Rat.

latest
Source
npmnpm
Version
0.1.28
Version published
Weekly downloads
10
-37.5%
Maintainers
2
Weekly downloads
 
Created
Source

rat-overlay

组件介绍

安装

$ npm install rat-overlay --save

引用

import Overlay from 'rat-overlay';
import Button from 'rat-button';
import Text from 'rat-text';

const { Popup } = Overlay;

render(
    <Popup trigger={<Button>Open</Button>} triggerType="click">
        <Text>
            Hello World From Popup!
        </Text>
    </Popup>);

class Demo extends Component {
    constructor(props) {
        super(props);

        this.state = {
            visible: false
        };
    }

    onClick = () => {
        this.setState({
            visible: true
        });
    }

    onClose = () => {
        this.setState({
            visible: false
        });
    }

    render() {
        return (
            <View>
                <Button onClick={this.onClick} ref={ref => {
                    this.btn = ref;
                }}>
                    Open
                </Button>
                <Overlay visible={this.state.visible}
                    safeNode={() => this.btn}
                    align="cc cc"
                    hasMask
                    disableScroll
                    onRequestClose={this.onClose}>
                    <Text>
                        Hello World From Overlay!
                    </Text>
                </Overlay>
            </View>
        );
    }
}

API

参数说明类型默认值是否必填
visible是否显示弹层Booleanfalse
target弹层定位的参照元素anyfalse
offset弹层相对于参照元素定位的微调Array[0, 0]
hasMask是否显示遮罩Booleanfalse
safeNode安全节点,当点击 document 的时候,如果包含该节点则不会关闭弹层,如果是函数需要返回 ref,如果是字符串则是该 DOM 的 id,也可以直接传入 DOM 节点,或者以上值组成的数组any-

Keywords

rat

FAQs

Package last updated on 18 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts