removed backdrop
This commit is contained in:
parent
e8504c6627
commit
33f6220622
@ -12,28 +12,29 @@ 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();
|
||||||
closeModal(); // Close the modal via React state
|
};
|
||||||
};
|
|
||||||
|
|
||||||
modalElement.addEventListener('hidden.bs.modal', handleHideModal);
|
modalElement.addEventListener('hidden.bs.modal', handleHideModal);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
modalElement.removeEventListener('hidden.bs.modal', handleHideModal);
|
||||||
|
};
|
||||||
|
}, [isOpen, closeModal]);
|
||||||
|
|
||||||
return () => {
|
|
||||||
modalElement.removeEventListener('hidden.bs.modal', handleHideModal);
|
|
||||||
};
|
|
||||||
}, [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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user