Fix StoryViewer and update spring animations

This commit is contained in:
Jamie Kyle 2024-09-04 09:33:58 -07:00 committed by GitHub
parent ee0090bb84
commit 8c770934e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 34 additions and 15 deletions

View file

@ -18,6 +18,7 @@ import { useIsMounted } from '../hooks/useIsMounted';
import type { LocalizerType } from '../types/I18N';
import { usePrevious } from '../hooks/usePrevious';
import { difference } from '../util/setUtil';
import { useReducedMotion } from '../hooks/useReducedMotion';
const DEFAULT_LIFETIME = 5000;
const DEFAULT_TRANSITION_FROM = {
@ -225,7 +226,10 @@ export function CallingToastProvider({
const toastsRemoved = difference(prevToasts, curToasts);
const toastsAdded = difference(curToasts, prevToasts);
const reducedMotion = useReducedMotion();
const transitions = useTransition(toasts, {
immediate: reducedMotion,
from: item => {
const enteringItemIndex = toasts.findIndex(
toast => toast.key === item.key