Skip to content

Commit cc9817f

Browse files
authored
fix: react to custom toast height changes (#646)
1 parent 3390bfe commit cc9817f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ const Toast = (props: ToastProps) => {
163163
}, [setHeights, toast.id]);
164164

165165
React.useLayoutEffect(() => {
166+
// Keep height up to date with the content in case it updates
166167
if (!mounted) return;
167168
const toastNode = toastRef.current;
168169
const originalHeight = toastNode.style.height;
@@ -180,7 +181,7 @@ const Toast = (props: ToastProps) => {
180181
return heights.map((height) => (height.toastId === toast.id ? { ...height, height: newHeight } : height));
181182
}
182183
});
183-
}, [mounted, toast.title, toast.description, setHeights, toast.id]);
184+
}, [mounted, toast.title, toast.description, setHeights, toast.id, toast.jsx, toast.action, toast.cancel]);
184185

185186
const deleteToast = React.useCallback(() => {
186187
// Save the offset for the exit swipe animation

0 commit comments

Comments
 (0)