Skip to content

Commit 531b521

Browse files
fix: modal options across open modal calls (#60)
* fix: update the modal props on every showModal call * chore: bump version
1 parent 396dbd1 commit 531b521

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"modal",
99
"useModal"
1010
],
11-
"version": "0.2.1",
11+
"version": "0.2.2",
1212
"main": "lib/index",
1313
"types": "lib",
1414
"files": [

src/Modal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const ModalProvider: React.FC<ModalProviderProps> = ({
3838
const showModal = useCallback(
3939
(content: React.ReactNode, options?: Partial<ModalProps>) => {
4040
setContent(content);
41-
if (options) optionsRef.current = options;
41+
optionsRef.current = options;
4242
},
4343
[],
4444
);
@@ -47,10 +47,10 @@ export const ModalProvider: React.FC<ModalProviderProps> = ({
4747
setContent(null);
4848
}, []);
4949

50-
const value = useMemo(() => ({ showModal, closeModal }), [
51-
showModal,
52-
closeModal,
53-
]);
50+
const value = useMemo(
51+
() => ({ showModal, closeModal }),
52+
[showModal, closeModal],
53+
);
5454

5555
return (
5656
<ModalContext.Provider value={value}>

0 commit comments

Comments
 (0)