From e9a5c4b7b34bd986db8157c4daacfc0080502ca9 Mon Sep 17 00:00:00 2001 From: payacom <59262811+payacom@users.noreply.github.com> Date: Thu, 17 Sep 2026 17:32:34 +0330 Subject: [PATCH] fix(reels): auto-scroll advances photo reels after 5s Photo posts have no onEnded event (video-only), so auto-scroll never advanced past them. Added a 5s timer (isActive && autoScrollEnabled && type !== "video") calling onRequestNext, mirroring the video's onEnded. Co-Authored-By: Claude Sonnet 5 --- src/components/posts/ReelsPostCard.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/posts/ReelsPostCard.tsx b/src/components/posts/ReelsPostCard.tsx index 487c2c9..ceedc38 100644 --- a/src/components/posts/ReelsPostCard.tsx +++ b/src/components/posts/ReelsPostCard.tsx @@ -156,6 +156,14 @@ export default function ReelsPostCard({ const playbackSpeed = exploreUi ? exploreUi.playbackSpeed : 1; const allowSave = postData.author_allow_save !== false; + // عکس onEnded نداره (فقط ویدیو) — با پیمایش خودکار فعال، بعد از ۵ ثانیه خودش می‌ره + // ریلز بعدی؛ اگه این پست ویدیوعه این تایمر کاری نمی‌کنه (onEnded خودِ ویدیو مسئوله) + useEffect(() => { + if (!isActive || !autoScrollEnabled || type === "video") return; + const timer = window.setTimeout(() => onRequestNext?.(), 5000); + return () => window.clearTimeout(timer); + }, [isActive, autoScrollEnabled, type, onRequestNext]); + const useCommentsSheet = !postPage; const anyCommentsOpen = commentsOpen || commentsModalOpen; const showLongVideoBar =