An opinionated toast component for React.
fix: react to custom toast height changes (#646)
Emil Kowalskicc9817f4160e
diff --git a/src/index.tsx b/src/index.tsxindex 5c0e9aa..4956fa8 100644--- a/src/index.tsx+++ b/src/index.tsx@@ -163,6 +163,7 @@ const Toast = (props: ToastProps) => {}, [setHeights, toast.id]);React.useLayoutEffect(() => {+ // Keep height up to date with the content in case it updatesif (!mounted) return;const toastNode = toastRef.current;const originalHeight = toastNode.style.height;@@ -180,7 +181,7 @@ const Toast = (props: ToastProps) => {return heights.map((height) => (height.toastId === toast.id ? { ...height, height: newHeight } : height));}});- }, [mounted, toast.title, toast.description, setHeights, toast.id]);+ }, [mounted, toast.title, toast.description, setHeights, toast.id, toast.jsx, toast.action, toast.cancel]);const deleteToast = React.useCallback(() => {// Save the offset for the exit swipe animation