[카테고리] 드롭다운관련 수정
- 현재 상품 카테고리에 드롭다운 선택이 정상적이지않아 확인해보니 enact dropdown에서는 onchange부분이 지원하지않아 onselect로 수정.
This commit is contained in:
@@ -1,12 +1,15 @@
|
|||||||
import React, { memo, useCallback } from "react";
|
import React, {
|
||||||
|
memo,
|
||||||
|
useCallback,
|
||||||
|
} from 'react';
|
||||||
|
|
||||||
import classNames from "classnames";
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import DropDown from "@enact/sandstone/Dropdown";
|
import DropDown from '@enact/sandstone/Dropdown';
|
||||||
|
|
||||||
import { countryCode } from "../../api/apiConfig";
|
import { countryCode } from '../../api/apiConfig';
|
||||||
import useScrollReset from "../../hooks/useScrollReset";
|
import useScrollReset from '../../hooks/useScrollReset';
|
||||||
import css from "./TDropDown.module.less";
|
import css from './TDropDown.module.less';
|
||||||
|
|
||||||
export default memo(function TDropDown({
|
export default memo(function TDropDown({
|
||||||
children,
|
children,
|
||||||
@@ -35,16 +38,12 @@ export default memo(function TDropDown({
|
|||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
}, [onClose]);
|
}, [onClose]);
|
||||||
|
|
||||||
const _onChange = useCallback((event) => {
|
const _onSelect = useCallback((event) => {
|
||||||
console.log('[TDropDown] 🔥 _onChange 호출됨! event:', event);
|
|
||||||
console.log('[TDropDown] event.selected:', event.selected);
|
|
||||||
console.log('[TDropDown] onSelect 콜백 존재:', !!onSelect);
|
|
||||||
if (onSelect) {
|
if (onSelect) {
|
||||||
console.log('[TDropDown] ✅ onSelect 콜백 실행 중...');
|
|
||||||
onSelect({ selected: event.selected });
|
onSelect({ selected: event.selected });
|
||||||
}
|
}
|
||||||
}, [onSelect]);
|
}, [onSelect]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropDown
|
<DropDown
|
||||||
@@ -57,7 +56,7 @@ export default memo(function TDropDown({
|
|||||||
)}
|
)}
|
||||||
direction={direction}
|
direction={direction}
|
||||||
selected={selectedIndex}
|
selected={selectedIndex}
|
||||||
onChange={_onChange}
|
onSelect={_onSelect}
|
||||||
onFocus={handleScrollReset}
|
onFocus={handleScrollReset}
|
||||||
onBlur={handleStopScrolling}
|
onBlur={handleStopScrolling}
|
||||||
onOpen={_onOpen}
|
onOpen={_onOpen}
|
||||||
@@ -72,4 +71,4 @@ export default memo(function TDropDown({
|
|||||||
{children}
|
{children}
|
||||||
</DropDown>
|
</DropDown>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user