trandingnow back key error

This commit is contained in:
yonghyon
2024-07-19 16:59:06 +09:00
parent 4181f73ec8
commit b360e57a02
3 changed files with 10 additions and 6 deletions

View File

@@ -22,16 +22,16 @@ const TPanel = ({
handleCancel, handleCancel,
isTabActivated = true, isTabActivated = true,
spotlightId = SpotlightIds.TPANEL, spotlightId = SpotlightIds.TPANEL,
isOnTop=false,
...rest ...rest
}) => { }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
delete rest.panelInfo;
delete rest.isOnTop;
const isGnbOpened = useSelector((state) => state.common.isGnbOpened); const isGnbOpened = useSelector((state) => state.common.isGnbOpened);
const onCancel = useCallback( const onCancel = useCallback(
(e) => { (e) => {
if (isGnbOpened) { if (isGnbOpened || isOnTop) {
return; return;
} }
if (handleCancel) { if (handleCancel) {
@@ -41,8 +41,9 @@ const TPanel = ({
e.stopPropagation(); e.stopPropagation();
} }
}, },
[dispatch, handleCancel, isTabActivated, isGnbOpened] [dispatch, handleCancel, isTabActivated, isGnbOpened, isOnTop]
); );
delete rest.panelInfo;
return ( return (
<CancelablePanel <CancelablePanel

View File

@@ -152,9 +152,10 @@ export default function DetailPanel({ panelInfo, isOnTop, spotlightId }) {
Spotlight.focus("spotlightId_backBtn"); Spotlight.focus("spotlightId_backBtn");
}; };
const onClick = useCallback(() => { const onClick = useCallback((ev) => {
dispatch(finishVideoPreview()); dispatch(finishVideoPreview());
dispatch(popPanel(panel_names.DETAIL_PANEL)); dispatch(popPanel(panel_names.DETAIL_PANEL));
ev.stopPropagation();
}, [dispatch]); }, [dispatch]);
const handleSMSonClose = useCallback(() => { const handleSMSonClose = useCallback(() => {

View File

@@ -42,7 +42,7 @@ const STRING_CONF = {
POPULAR_SHOW: "POPULAR SHOW", POPULAR_SHOW: "POPULAR SHOW",
BEST_SELLER: "BEST SELLER", BEST_SELLER: "BEST SELLER",
}; };
const TrendingNowPanel = ({ panelInfo, spotlightId }) => { const TrendingNowPanel = ({ panelInfo, spotlightId, isOnTop }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const topInfos = useSelector((state) => state.main.top20ShowData?.topInfos); const topInfos = useSelector((state) => state.main.top20ShowData?.topInfos);
const bestSellerDatas = useSelector( const bestSellerDatas = useSelector(
@@ -153,9 +153,11 @@ const TrendingNowPanel = ({ panelInfo, spotlightId }) => {
}, [panelInfo]); }, [panelInfo]);
useEffect(() => { useEffect(() => {
if(isOnTop){
timerRef.current = setTimeout(() => { timerRef.current = setTimeout(() => {
Spotlight.focus(targetId); Spotlight.focus(targetId);
}, 0); }, 0);
}
return () => clearTimeout(timerRef.current); return () => clearTimeout(timerRef.current);
}, [targetId]); }, [targetId]);