ant-design/components/select/useShowArrow.ts
MuxinFeng 084f234bc9
refactor: Select deprecated showArrow prop (#43520)
* refactor: remove showArrow prop

* fix: optimize iconUtil

* refactor: refactor tree-select&cascader

* docs: update api docs

* test: add test

* fix: update warning

* chore: update dep version

* test: update test
2023-07-19 20:27:09 +08:00

12 lines
381 B
TypeScript

import type { ReactNode } from 'react';
/**
* Since Select, TreeSelect, Cascader is same Select like component.
* We just use same hook to handle this logic.
*
* If `suffixIcon` is not equal to `null`, always show it.
*/
export default function useShowArrow(suffixIcon?: ReactNode, showArrow?: boolean) {
return showArrow !== undefined ? showArrow : suffixIcon !== null;
}