From fa1dde0f7a926d2824dc43859a7df3c8a1742030 Mon Sep 17 00:00:00 2001 From: Jeremias Jutz Date: Mon, 14 Oct 2024 09:11:42 +0200 Subject: [PATCH] fix initial nested transform --- src/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 76aad6d..503c648 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -680,7 +680,7 @@ export function Root({ function onNestedOpenChange(o: boolean) { const scale = o ? (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth : 1; - const y = o ? -NESTED_DISPLACEMENT : 0; + const initialTranslate = o ? -NESTED_DISPLACEMENT : 0; if (nestedOpenChangeTimer.current) { window.clearTimeout(nestedOpenChangeTimer.current); @@ -688,7 +688,7 @@ export function Root({ set(drawerRef.current, { transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`, - transform: `scale(${scale}) translate3d(0, ${y}px, 0)`, + transform: isVertical(direction) ? `scale(${scale}) translate3d(0, ${initialTranslate}px, 0)` : `scale(${scale}) translate3d(${initialTranslate}, 0, 0)`, }); if (!o && drawerRef.current) {