rax-modal
提供了弹出遮罩层的能力,为 Alert
, Confirm
等对话框组件提供底层能力。
$ npm install rax-modal --save
import RaxModal from 'rax-modal';
import {createElement, Component, render} from 'rax';
import Modal from 'rax-modal';
const Demo = (props) => {
const [visible, setVisible] = useState(false);
return ([
<View onClick={() => setVisible(true)}><Text>open</Text></View>,
<Modal
visible={visible}
onHide={() => {
setVisible(false)
}}
onShow ={() => {
setVisible(true)
}}
maskCanBeClick={true}
contentStyle={{
position: "absolute",
top: "150rpx",
width: "400rpx",
left: "175rpx"
}}
>
<Text>这里是弹窗内容</Text>
</Modal>
]);
}
render(<Demo />);