removed backdrop

This commit is contained in:
Pramod Mahajan 2025-05-16 19:07:15 +05:30
parent 9a0482071a
commit 1c1a1da8a0

View File

@ -12,20 +12,20 @@ const GlobalModel = ({
}) => { }) => {
const modalRef = useRef(null); // Reference to the modal element const modalRef = useRef(null); // Reference to the modal element
useEffect(() => { useEffect(() => {
const modalElement = modalRef.current; const modalElement = modalRef.current;
const modalInstance = new window.bootstrap.Modal(modalElement); const modalInstance = new window.bootstrap.Modal(modalElement, {
backdrop: false // Disable backdrop
});
// Show modal if isOpen is true
if (isOpen) { if (isOpen) {
modalInstance.show(); modalInstance.show();
} else { } else {
modalInstance.hide(); modalInstance.hide();
} }
// Handle modal hide event to invoke the closeModal function
const handleHideModal = () => { const handleHideModal = () => {
closeModal(); // Close the modal via React state closeModal();
}; };
modalElement.addEventListener('hidden.bs.modal', handleHideModal); modalElement.addEventListener('hidden.bs.modal', handleHideModal);
@ -33,7 +33,8 @@ const GlobalModel = ({
return () => { return () => {
modalElement.removeEventListener('hidden.bs.modal', handleHideModal); modalElement.removeEventListener('hidden.bs.modal', handleHideModal);
}; };
}, [isOpen, closeModal]); }, [isOpen, closeModal]);
// Dynamically set the modal size classes (modal-sm, modal-lg, modal-xl) // Dynamically set the modal size classes (modal-sm, modal-lg, modal-xl)
const modalSizeClass = size ? `modal-${size}` : ''; // Default is empty if no size is specified const modalSizeClass = size ? `modal-${size}` : ''; // Default is empty if no size is specified