@eslam-elmeniawy/react-native-common-components
Version:
Common `ReactNative` components packed in library for usage in projects.
58 lines (53 loc) • 1.59 kB
JavaScript
;
// External imports.
import * as React from 'react';
import { StyleSheet } from 'react-native';
import { withTheme, ActivityIndicator } from 'react-native-paper';
// Types imports.
// Internal imports.
import styles from "./LoadingDialog.styles.js";
import { Dialog } from "../Dialog/index.js";
/**
* LoadingDialog component (unwrapped, for testing)
* Displays a loading dialog with an activity indicator
* @internal For testing purposes only. Do not use in production code.
*/
import { jsx as _jsx } from "react/jsx-runtime";
export const LoadingDialogComponent = /*#__PURE__*/React.memo(props => {
const {
visible,
theme,
dialogProps,
loader,
activityIndicatorProps
} = props;
const {
dismissable,
style: dialogStyle,
...restDialogProps
} = dialogProps ?? {};
const {
size,
color,
...restActivityIndicatorProps
} = activityIndicatorProps ?? {};
return /*#__PURE__*/_jsx(Dialog, {
visible: visible,
dismissable: dismissable ?? false,
style: StyleSheet.flatten([styles.dialog, dialogStyle]),
...restDialogProps,
children: loader ?? /*#__PURE__*/_jsx(ActivityIndicator, {
animating: visible,
size: size ?? 'large',
color: color ?? theme.colors.surface,
...restActivityIndicatorProps
})
});
});
LoadingDialogComponent.displayName = 'LoadingDialogComponent';
/**
* LoadingDialog component (wrapped with theme, for production)
*/
const LoadingDialog = withTheme(LoadingDialogComponent);
export default LoadingDialog;
//# sourceMappingURL=LoadingDialog.js.map