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