Skip to content

Commit

Permalink
fix: modal options across open modal calls (#60)
Browse files Browse the repository at this point in the history
* fix: update the modal props on every showModal call

* chore: bump version
  • Loading branch information
mdsiddiq-till committed Feb 14, 2024
1 parent 396dbd1 commit 531b521
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"modal",
"useModal"
],
"version": "0.2.1",
"version": "0.2.2",
"main": "lib/index",
"types": "lib",
"files": [
Expand Down
10 changes: 5 additions & 5 deletions src/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const ModalProvider: React.FC<ModalProviderProps> = ({
const showModal = useCallback(
(content: React.ReactNode, options?: Partial<ModalProps>) => {
setContent(content);
if (options) optionsRef.current = options;
optionsRef.current = options;
},
[],
);
Expand All @@ -47,10 +47,10 @@ export const ModalProvider: React.FC<ModalProviderProps> = ({
setContent(null);
}, []);

const value = useMemo(() => ({ showModal, closeModal }), [
showModal,
closeModal,
]);
const value = useMemo(
() => ({ showModal, closeModal }),
[showModal, closeModal],
);

return (
<ModalContext.Provider value={value}>
Expand Down

0 comments on commit 531b521

Please sign in to comment.