@@ -10,6 +10,7 @@ import { isValidateOpenKey } from '../utils/keyUtil';
1010import clsx from 'clsx' ;
1111import type { ComponentsConfig } from '../hooks/useComponents' ;
1212import { getDOM } from '@rc-component/util/lib/Dom/findDOMNode' ;
13+ import { composeRef } from '@rc-component/util/lib/ref' ;
1314
1415export interface SelectInputRef {
1516 focus : ( options ?: FocusOptions ) => void ;
@@ -153,9 +154,8 @@ export default React.forwardRef<SelectInputRef, SelectInputProps>(function Selec
153154 ) ;
154155
155156 // ====================== Refs ======================
156- React . useImperativeHandle (
157- ref ,
158- ( ) => ( {
157+ React . useImperativeHandle ( ref , ( ) => {
158+ return {
159159 focus : ( options ?: FocusOptions ) => {
160160 // Focus the inner input if available, otherwise fall back to root div.
161161 ( inputRef . current || rootRef . current ) . focus ?.( options ) ;
@@ -164,9 +164,8 @@ export default React.forwardRef<SelectInputRef, SelectInputProps>(function Selec
164164 ( inputRef . current || rootRef . current ) . blur ?.( ) ;
165165 } ,
166166 nativeElement : rootRef . current ,
167- } ) ,
168- [ ] ,
169- ) ;
167+ } ;
168+ } ) ;
170169
171170 // ====================== Open ======================
172171 const onInternalMouseDown : SelectInputProps [ 'onMouseDown' ] = useEvent ( ( event ) => {
@@ -231,7 +230,7 @@ export default React.forwardRef<SelectInputRef, SelectInputProps>(function Selec
231230 sharedProps . onBlur ( e ) ;
232231 oriProps . onBlur ?.( e ) ;
233232 } ,
234- ref : rootRef ,
233+ ref : composeRef ( ( RootComponent as any ) . ref , rootRef ) ,
235234 } ) ;
236235 }
237236 return < RootComponent { ...sharedProps } ref = { rootRef } /> ;
0 commit comments