Merge pull request #1098 from robintown/fix-new-grid

Fix tiles not animating in the new grid layout
This commit is contained in:
Robin 2023-06-10 17:09:21 -04:00 committed by GitHub
commit 825cb75cb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -266,11 +266,16 @@ export const NewVideoGrid: FC<Props> = ({
},
leave: { opacity: 0, scale: 0, immediate: disableAnimations },
config: { mass: 0.7, tension: 252, friction: 25 },
}),
[tiles, disableAnimations]
})
// react-spring's types are bugged and can't infer the spring type
) as unknown as [TransitionFn<Tile, TileSpring>, SpringRef<TileSpring>];
// Because we're using react-spring in imperative mode, we're responsible for
// firing animations manually whenever the tiles array updates
useEffect(() => {
springRef.start();
}, [tiles, springRef]);
const animateDraggedTile = (endOfGesture: boolean) => {
const { tileId, tileX, tileY, cursorX, cursorY } = dragState.current!;
const tile = tiles.find((t) => t.item.id === tileId)!;