@brightlayer-ui/react-native-auth-workflow
Version:
Re-usable workflow components for Authentication and Registration within Eaton applications.
45 lines (44 loc) • 2.06 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import React from 'react';
import { Paragraph, Dialog, Portal, Button } from 'react-native-paper';
import { StyleSheet } from 'react-native';
const makeStyles = () => StyleSheet.create({
basicDialog: {
minWidth: 300,
maxWidth: 600,
alignSelf: 'center',
},
actions: {
flexGrow: 0,
},
});
/**
* Component that renders a basic dialog with a title, body description, and a close button.
*
* @param {BasicDialogProps} props - Basic props of Dialog
*
* @category Component
*/
export const BasicDialog = (props) => {
const { title, body, dismissButtonText, open = false, onDismiss, style } = props, otherDialogProps = __rest(props, ["title", "body", "dismissButtonText", "open", "onDismiss", "style"]);
const defaultStyles = makeStyles();
return (React.createElement(Portal, null,
React.createElement(Dialog, Object.assign({ visible: open, dismissable: false, style: [defaultStyles.basicDialog, style] }, otherDialogProps),
React.createElement(Dialog.Title, null, title),
React.createElement(Dialog.Content, null,
React.createElement(Paragraph, null, body)),
React.createElement(Dialog.Actions, { style: [defaultStyles.actions] },
React.createElement(Button, { testID: "blui-basic-dialog-dismiss-button", onPress: () => {
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
} }, dismissButtonText !== null && dismissButtonText !== void 0 ? dismissButtonText : 'Okay')))));
};