From 0767b6b4db3a69f54d1fc2de11a883d9deec4445 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 29 Aug 2024 21:08:47 +0800 Subject: [PATCH] fix: feed column animation direction --- src/renderer/src/modules/feed-column/index.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/modules/feed-column/index.tsx b/src/renderer/src/modules/feed-column/index.tsx index 4d8d76077..63a569885 100644 --- a/src/renderer/src/modules/feed-column/index.tsx +++ b/src/renderer/src/modules/feed-column/index.tsx @@ -237,7 +237,10 @@ const SwipeWrapper: FC<{ setDirection("left") } } - setCurrentAnimatedActive(active) + // eslint-disable-next-line @eslint-react/web-api/no-leaked-timeout + setTimeout(() => { + setCurrentAnimatedActive(active) + }, 0) if (prevActiveIndexRef.current !== -1) { setIsReady(true) } @@ -256,13 +259,13 @@ const SwipeWrapper: FC<{ initial={ isReady ? { - x: direction === "right" ? -feedColumnWidth : feedColumnWidth, + x: direction === "right" ? feedColumnWidth : -feedColumnWidth, } : true } animate={{ x: 0 }} exit={{ - x: direction === "right" ? feedColumnWidth : -feedColumnWidth, + x: direction === "right" ? -feedColumnWidth : feedColumnWidth, }} transition={{ x: { type: "spring", stiffness: 700, damping: 40 },