We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8bdd5b4 commit c4e0e39Copy full SHA for c4e0e39
src/dialog/Modal.jsx
@@ -115,13 +115,15 @@ Modal.propTypes = {
115
};
116
117
function hideModal(modalRef) {
118
- modalRef.current.style.display = 'none';
119
- modalRef.current.classList.remove('show');
+ if (modalRef.current) {
+ modalRef.current.style.display = 'none';
120
+ modalRef.current.classList.remove('show');
121
+ }
122
123
hideModalBackdrop();
124
enableBodyScroll();
125
- if (modalRef.current.style.zIndex) {
126
+ if (modalRef.current && modalRef.current.style.zIndex) {
127
modalRef.current.style.zIndex = null;
128
}
129
@@ -133,6 +135,10 @@ function enableBodyScroll() {
133
135
134
136
137
function showModal(modalRef) {
138
+ if (!modalRef.current) {
139
+ return;
140
141
+
142
disableBodyScroll();
143
showModalBackdrop();
144
0 commit comments