From 2a1c95a44788bb16d37415170c680b3e1a9b86bb Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sun, 2 Mar 2025 16:04:45 +0100 Subject: [PATCH] Update reply-modal.tsx --- src/components/reply-modal/reply-modal.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/components/reply-modal/reply-modal.tsx b/src/components/reply-modal/reply-modal.tsx index 48c15ef3..53bec575 100644 --- a/src/components/reply-modal/reply-modal.tsx +++ b/src/components/reply-modal/reply-modal.tsx @@ -145,29 +145,26 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s const nodeRef = useRef(null); const isMobile = useIsMobile(); - const [{ x, y }, api] = useSpring(() => ({ x: 0, y: 0 })); + const [{ x, y }, api] = useSpring(() => ({ + x: window.innerWidth / 2 - 150, + y: window.innerHeight / 2 - 400, + })); const bind = useDrag( - ({ offset: [ox, oy], first, last }) => { + ({ offset: [ox, oy] }) => { api.start({ x: ox, y: oy, immediate: true }); }, { from: () => [x.get(), y.get()], filterTaps: true, - bounds: { - left: -300, - right: window.innerWidth - 100, - top: 0, - bottom: window.innerHeight - 100, - }, + bounds: undefined, }, ); useEffect(() => { if (nodeRef.current && isMobile) { const viewportHeight = window.innerHeight; - const modalHeight = 150; - const centeredPosition = scrollY + viewportHeight / 2 - modalHeight / 2; + const centeredPosition = scrollY + viewportHeight / 2 - 300; api.start({ y: centeredPosition, immediate: true }); } }, [isMobile, scrollY, api]);