File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,7 +45,20 @@ const HomeTabBar: React.FC<HomeTabBarProps> = ({ onOpenBottomSheet }) => {
4545 } ;
4646
4747 const handleSwiperChange = ( swiper : SwiperCore ) => {
48- setActiveIndex ( swiper . activeIndex ) ;
48+ // 매칭 요청이 없고 1번 index에 있을 때 0번 탭 비활성화
49+ if ( ! hasMatchingRequests && swiper . activeIndex === 1 ) {
50+ swiper . allowSlidePrev = false ;
51+ setActiveIndex ( swiper . activeIndex ) ;
52+ }
53+ // 매칭 요청이 없고 0번 index에 있을 때 1번 탭으로 이동
54+ else if ( ! hasMatchingRequests && swiper . activeIndex === 0 ) {
55+ swiper . slideNext ( ) ;
56+ }
57+ // 매칭 요청이 있을 때 양쪽 스와이퍼 가능
58+ else {
59+ swiper . allowSlidePrev = true ;
60+ setActiveIndex ( swiper . activeIndex ) ;
61+ }
4962 } ;
5063
5164 const fetchMatchingRequests = async ( ) => {
@@ -100,6 +113,7 @@ const HomeTabBar: React.FC<HomeTabBarProps> = ({ onOpenBottomSheet }) => {
100113 swiperRef . current = swiper ;
101114 } }
102115 onSlideChange = { handleSwiperChange }
116+ allowSlidePrev = { hasMatchingRequests }
103117 spaceBetween = { 0 }
104118 slidesPerView = { 1 }
105119 autoHeight = { true }
You can’t perform that action at this time.
0 commit comments