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 <noreply@anthropic.com>
This commit is contained in:
payacom
2026-09-17 17:32:34 +03:30
parent e7ce4d6808
commit e9a5c4b7b3

View File

@@ -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 =