[TrendingNowPanel] video preview focus issue
This commit is contained in:
@@ -21,6 +21,7 @@ export default function PopularShowIndicator({
|
|||||||
selectedIndex,
|
selectedIndex,
|
||||||
handleItemFocus,
|
handleItemFocus,
|
||||||
handleItemClick,
|
handleItemClick,
|
||||||
|
isOnTop,
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
thumbnailUrl960,
|
thumbnailUrl960,
|
||||||
@@ -79,6 +80,7 @@ export default function PopularShowIndicator({
|
|||||||
handleItemClick={_handleItemClick}
|
handleItemClick={_handleItemClick}
|
||||||
handleItemFocus={_handleItemFocus}
|
handleItemFocus={_handleItemFocus}
|
||||||
patncNm={patncNm}
|
patncNm={patncNm}
|
||||||
|
isOnTop={isOnTop}
|
||||||
/>
|
/>
|
||||||
</Container>
|
</Container>
|
||||||
<Container className={css.popularProductListContainer}>
|
<Container className={css.popularProductListContainer}>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import React, { useCallback, useEffect, useRef, useState } from "react";
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
import { Job } from "@enact/core/util";
|
import { Job } from "@enact/core/util";
|
||||||
|
import Spotlight from "@enact/spotlight";
|
||||||
import Spottable from "@enact/spotlight/Spottable";
|
import Spottable from "@enact/spotlight/Spottable";
|
||||||
import { Marquee } from "@enact/ui/Marquee";
|
import { Marquee } from "@enact/ui/Marquee";
|
||||||
|
|
||||||
@@ -47,10 +48,27 @@ export default function PopularVideoCard({
|
|||||||
handleItemFocus,
|
handleItemFocus,
|
||||||
patncNm,
|
patncNm,
|
||||||
handleItemClick,
|
handleItemClick,
|
||||||
|
isOnTop,
|
||||||
}) {
|
}) {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const [isFocused, setIsFocused] = useState(false);
|
const [isFocused, setIsFocused] = useState(false);
|
||||||
const videoFocusTimeoutJob = useRef(new Job((func) => func(), 1000));
|
const videoFocusTimeoutJob = useRef(new Job((func) => func(), 1000));
|
||||||
|
const isFullScreenModeActivedRef = useRef(false);
|
||||||
|
|
||||||
|
const cursorVisible = useSelector(
|
||||||
|
(state) => state.common.appStatus.cursorVisible
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isFullScreenModeActivedRef.current && isOnTop) {
|
||||||
|
setTimeout(() => {
|
||||||
|
if (cursorVisible || Spotlight.getPointerMode()) {
|
||||||
|
dispatch(finishVideoPreview());
|
||||||
|
isFullScreenModeActivedRef.current = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [cursorVisible, isOnTop]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const videoFocusTimeoutJobValue = videoFocusTimeoutJob.current;
|
const videoFocusTimeoutJobValue = videoFocusTimeoutJob.current;
|
||||||
@@ -72,6 +90,8 @@ export default function PopularVideoCard({
|
|||||||
modalClassName: css.videoModal,
|
modalClassName: css.videoModal,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
isFullScreenModeActivedRef.current = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => videoFocusTimeoutJobValue.stop();
|
return () => videoFocusTimeoutJobValue.stop();
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ import TVerticalPagenator from "../../components/TVerticalPagenator/TVerticalPag
|
|||||||
import usePrevious from "../../hooks/usePrevious";
|
import usePrevious from "../../hooks/usePrevious";
|
||||||
import useScrollReset from "../../hooks/useScrollReset";
|
import useScrollReset from "../../hooks/useScrollReset";
|
||||||
import useScrollTo from "../../hooks/useScrollTo";
|
import useScrollTo from "../../hooks/useScrollTo";
|
||||||
|
import useWhyDidYouUpdate from "../../hooks/useWhyDidYouUpdate";
|
||||||
import { LOG_MENU, panel_names } from "../../utils/Config";
|
import { LOG_MENU, panel_names } from "../../utils/Config";
|
||||||
import { $L, scaleH } from "../../utils/helperMethods";
|
import { $L, scaleH } from "../../utils/helperMethods";
|
||||||
import PopularShowIndicator from "./PopularShow/PopularShowIndicator";
|
import PopularShowIndicator from "./PopularShow/PopularShowIndicator";
|
||||||
import useWhyDidYouUpdate from "../../hooks/useWhyDidYouUpdate";
|
|
||||||
import css from "./TrendingNowPanel.module.less";
|
import css from "./TrendingNowPanel.module.less";
|
||||||
|
|
||||||
const Container = SpotlightContainerDecorator(
|
const Container = SpotlightContainerDecorator(
|
||||||
@@ -325,6 +325,7 @@ const TrendingNowPanel = ({ panelInfo, spotlightId, isOnTop, ...rest }) => {
|
|||||||
selectedIndex={selectedIndex}
|
selectedIndex={selectedIndex}
|
||||||
handleItemFocus={handleItemFocus}
|
handleItemFocus={handleItemFocus}
|
||||||
handleItemClick={handleItemClick}
|
handleItemClick={handleItemClick}
|
||||||
|
isOnTop={isOnTop}
|
||||||
/>
|
/>
|
||||||
</Container>
|
</Container>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user