dynamic-modal 1.1.10 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/modal.tsx
CHANGED
|
@@ -28,8 +28,12 @@ import { IMakeButton } from './interfaces/make-button';
|
|
|
28
28
|
import { ComponentStateContext } from './context/component/component-state';
|
|
29
29
|
|
|
30
30
|
export const Modal = ({ open, close, config }: IModal) => {
|
|
31
|
-
const { ModalButtonAction, ModalButtonCancel } = useContext(
|
|
32
|
-
|
|
31
|
+
const { ModalButtonAction, ModalButtonCancel } = useContext(
|
|
32
|
+
ComponentStateContext,
|
|
33
|
+
);
|
|
34
|
+
const [modalReady, setModalReady] = useState<IModalConfigProps | undefined>(
|
|
35
|
+
undefined,
|
|
36
|
+
);
|
|
33
37
|
const [defaultLoaded, setDefaultLoaded] = useState<boolean>(false);
|
|
34
38
|
|
|
35
39
|
const {
|
|
@@ -160,7 +164,7 @@ export const Modal = ({ open, close, config }: IModal) => {
|
|
|
160
164
|
setTimeout(() => {
|
|
161
165
|
setModalReady(undefined);
|
|
162
166
|
setDefaultLoaded(false);
|
|
163
|
-
reset()
|
|
167
|
+
reset();
|
|
164
168
|
close();
|
|
165
169
|
}, 200);
|
|
166
170
|
};
|
|
@@ -196,7 +200,7 @@ export const Modal = ({ open, close, config }: IModal) => {
|
|
|
196
200
|
if (open && !modalReady) setModalReady(config);
|
|
197
201
|
}, [config, modalReady, open]);
|
|
198
202
|
|
|
199
|
-
if(!modalReady) return null
|
|
203
|
+
if (!modalReady) return null;
|
|
200
204
|
|
|
201
205
|
return (
|
|
202
206
|
<Portal closeTime={200} portalOpen={open} portalTag={'#modal-portal'}>
|
|
@@ -286,7 +290,7 @@ export const Modal = ({ open, close, config }: IModal) => {
|
|
|
286
290
|
</form>
|
|
287
291
|
</div>
|
|
288
292
|
</Portal>
|
|
289
|
-
)
|
|
293
|
+
);
|
|
290
294
|
};
|
|
291
295
|
|
|
292
296
|
export default Modal;
|