Fix(bds): 캐러셀 컴포넌트 IOS, And 대응 #477
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📌 Summary
📚 Tasks
슬라이드 안되는 문제
영상 보시면, 모바일 환경에서 슬라이드 할 때 아예 옆으로 안 움직이는 문제가 있었습니다.
[ IOS AS-IS ]
ScreenRecording_10-26-2025.02-10-51_1.MP4
해당 문제를 다음과 같이 해결했습니다.
WebkitOverflowScrolling : 'touch'는 은 스크롤 화면의 '터치' 반응에 대해 더 자연스럽고 매끄럽게 빠른 반응을 활성화 합니다.-
touchAction: 'pan-x',는 스크롤을 가로 방향만 터치 허용하도록 합니다.이 두 속성을 캐러셀 컨테이너에 추가하고,
캐러셀 controller 중 handlePointerDown 과 handlePointerMove 에 해당 코드를 추가했습니다.
-> 터치 이벤트의 기본 동작(스크롤, 줌, 스와이프) 를 차단하고 터치 입력을 독점적으로 처리합니다.
이 코드가 왜 필요하냐면,
따라서 터치 이벤트가 발생하면(모바일) preventDefault 를 하도록 수정했습니다.
결과적으로 드래그 tobe 영상입니다
[ Android TO-BE ]
KakaoTalk_Video_2025-10-26-02-04-15.mp4
[ IOS TO-BE ]
ScreenRecording_10-25-2025.19-01-18_1.mov
autoPlay ture 일 때 지진나는 문제
이 코드 보시면, 원래는 autoPlay 일 때도 transition 이 있었습니다.
requestAnimationFrame 는 16ms 마다 계속 실행되는데, CSS transition 은 천천히 이동중이어서 (거의 안 움직이는)
두 이동 시간의 타이밍 차이가 문제였던 것 같아요.
정확히 설명하자면,
Frame 2 (16ms)
offsetRef.current = 10.5%setCarouselState({ offset: 10.5% })화면 렌더링
브라우저는
Frame 3 (32ms)
offsetRef.current = 11.0%setCarouselState({ offset: 11.0% })문제는 32ms 밖에 안 됐기 때문에 CSS transition 은 -10.016% 이정도 밖에 못 간 상태에서
다음 Frame 이 실행되는 바람에
새롭게 RAF 명령은 11.0% 로 가라는 명령을 받게 되면서
화면에서는
그래서 즉 RAF 는 빠르게 증가시키는데, CSS transtion 이 천천히 따라가려고 하는 문제 때문에 슬라이드가 덜덜덜 떨리는 현상이 생겼던 것 같습니다.
✅ 해결
autoPlay일 때 transition: 'none' 을 적용해서 RAF 와 transition 이 충돌하지 않도록 설정했어요.
그랬더니 안드 아이오 모두 잘 작동하는 것을 확인할 수 있었습니다.
[ IOS AS-IS ]
ScreenRecording_10-26-2025.02-06-57_1.MP4
[ IOS TO-BE ]
ScreenRecording_10-26-2025.01-58-02_1.mov