@gluestack-ui/alert-dialog
提醒Dialog有效地打断了用户的流量并促使他们采取特定行动. 通常用于强制确认或呼叫行动.
安装
要安装组件,请在终端中运行以下命令。 这将添加到您的项目的依赖性中, 并允许您在您的项目中使用它 .
npx gluestack-ui@latest add alert-dialog
使用量
所有这些组件的默认样式可以在组件/核心/默认样式中找到,所有这些组件的默认样式可以在组件/核心/提醒-对话框文件中找到. 作为参考,你可以查看 源代码 中,带有“警报”组件.
// import the styles
import {
Root,
Content,
CloseButton,
Header,
Footer,
Body,
Backdrop,
} from '../components/core/alert-dialog/styled-components';
// import the createAlertDialog function
import { createAlertDialog } from '@gluestack-ui/alert-dialog';
// Understanding the API
const AlertDialog = createAlertDialog({
Root,
Content,
CloseButton,
Header,
Footer,
Body,
Backdrop,
});
// Using the alert-dialog component
export default () => (
<AlertDialog>
<AlertDialogBackdrop />
<AlertDialogContent>
<AlertDialogHeader>
<Heading>Confirm your request</Heading>
<AlertDialogCloseButton>
<CloseIcon />
</AlertDialogCloseButton>
</AlertDialogHeader>
<AlertDialogBody>
<Text>AlertDialog Body</Text>
</AlertDialogBody>
<AlertDialogFooter>
<Button>
<ButtonText></ButtonText>
</Button>
<Button>
<ButtonText></ButtonText>
</Button>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
更多关于如何启动的指南 这里。 。 。 .