-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(select): 新增带搜索情况下,点击叉号按钮时下拉框同时清空(#2945) #2948
Conversation
packages/ui/select/src/Select.tsx
Outdated
@@ -236,7 +236,7 @@ export const Select = forwardRef<HTMLDivElement | null, SelectProps>( | |||
onOpen={menuVisibleAction.on} | |||
onClose={menuVisibleAction.off} | |||
searchable={searchable} | |||
keyword={keywordProp} | |||
keyword={searchValue} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此处这样改会影响搜索关键字的受控
packages/ui/picker/src/Picker.tsx
Outdated
/** | ||
* 提供辅助方法的内部引用 | ||
*/ | ||
innerRef?: React.Ref<HTMLDivElement> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTMLDivElement 改为 useImperativeHandle 中声明的方法,例如:interface PikcerHelper {resetSearch: () => void}
packages/ui/select/src/Select.tsx
Outdated
customRender, | ||
...rest | ||
}, | ||
ref | ||
) => { | ||
const i18n = useLocaleContext() | ||
|
||
const innerRef = useRef<HTMLDivElement>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTMLDivElement 改为上面说的 PikcerHelper
packages/ui/select/src/Select.tsx
Outdated
@@ -227,7 +229,7 @@ export const Select = forwardRef<HTMLDivElement | null, SelectProps>( | |||
return ( | |||
<SelectProvider value={context}> | |||
<Picker | |||
ref={ref} | |||
ref={mergeRefs(ref, innerRef)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议将 innerRef 放在该行下面,另外有了 innerRef 后不需要在使用 mergeRefs
搜索非受控模式下支持
closed #2945