fix: resize feed column width

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei 2024-07-26 12:56:58 +08:00
parent 26e4f3d474
commit 5701124306
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
1 changed files with 7 additions and 0 deletions

View File

@ -97,7 +97,14 @@ export function FeedColumn({ children }: PropsWithChildren) {
}, [setActive_])
useLayoutEffect(() => {
const handler = () => {
spring.jump(-active * jotaiStore.get(carouselWidthAtom))
}
const dispose = jotaiStore.sub(carouselWidthAtom, handler)
spring.set(-active * jotaiStore.get(carouselWidthAtom))
return () => {
dispose()
}
}, [active, spring])
useHotkeys(