diff --git a/src/index.tsx b/src/index.tsx index a3ea512..d831bdf 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -124,6 +124,10 @@ const Toast = (props: ToastProps) => { offset.current = React.useMemo(() => heightIndex * gap + toastsHeightBefore, [heightIndex, toastsHeightBefore]); + React.useEffect(() => { + remainingTime.current = duration; + }, [duration]); + React.useEffect(() => { // Trigger enter animation without using CSS animation setMounted(true); diff --git a/test/src/app/page.tsx b/test/src/app/page.tsx index 6730447..83db7d4 100644 --- a/test/src/app/page.tsx +++ b/test/src/app/page.tsx @@ -171,6 +171,23 @@ export default function Home({ searchParams }: any) { > Updated Toast +