From b5d6681faf7a5b639a6c75710c05d2b3253c2fe3 Mon Sep 17 00:00:00 2001 From: Carl Gunderson Date: Sun, 7 Jan 2024 14:44:31 -0800 Subject: [PATCH] mobile test --- src/components/JobItem/index.jsx | 5 ++--- src/components/Section/index.jsx | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/JobItem/index.jsx b/src/components/JobItem/index.jsx index 0d8d11f..8a969ac 100644 --- a/src/components/JobItem/index.jsx +++ b/src/components/JobItem/index.jsx @@ -141,12 +141,11 @@ const Arrow = ({ direction, isDisabled, isFilled, item, onClick }) => { sx={{ position: 'absolute', top: direction === 'prev' - ? [isIosSafari ? '40px' : '20px', '40px'] + ? ['20px', '40px'] : 'auto', bottom: direction === 'next' - ? [isIosSafari ? '40px' : '20px', '40px'] + ? ['20px', '40px'] : 'auto', - pb: isIosSafari ? '12px' : '0', }} > { const handleTouchEnd = () => { if (touchStart - touchEnd > 100) { // Down - if (activeIdx < jobs.length - 1) { + if (activeIdxRef.current < jobs.length - 1) { activeIdxRef.current = activeIdxRef.current + 1 - // setActiveIdx(activeIdxRef.current) - setActiveIdx(prevIdx => prevIdx + 1) + setActiveIdx(activeIdxRef.current) + // setActiveIdx(prevIdx => prevIdx + 1) } } if (touchStart - touchEnd < -100) { // Up - if (activeIdx > 0) { + if (activeIdxRef.current > 0) { activeIdxRef.current = activeIdxRef.current - 1 - // setActiveIdx(activeIdxRef.current) - setActiveIdx(prevIdx => prevIdx - 1) + setActiveIdx(activeIdxRef.current) + // setActiveIdx(prevIdx => prevIdx - 1) } } }