@@ -12,6 +12,7 @@ import refShape from '../shapes/refShape';
1212import optionsShape from '../shapes/optionsShape' ;
1313import valueShape from '../shapes/valueShape' ;
1414import indexesOf from '../util/indexesOf' ;
15+ import mergeRefs from '../util/mergeRefs' ;
1516import swapOptions from '../util/swapOptions' ;
1617import { ALIGNMENTS , KEYS } from '../constants' ;
1718import Action from './Action' ;
@@ -708,21 +709,6 @@ function DualListBox(props) {
708709 // Wrap event handlers with a controlKey reference
709710 const wrapHandler = ( handler ) => ( ( event ) => handler ( event , controlKey ) ) ;
710711
711- // Set both internal ref and property ref
712- /* eslint-disable no-param-reassign */
713- const makeRef = ( c ) => {
714- ref . current = c ;
715-
716- if ( refProp !== null ) {
717- if ( typeof refProp === 'function' ) {
718- refProp ( c ) ;
719- } else {
720- refProp . current = c ;
721- }
722- }
723- } ;
724- /* eslint-enable no-param-reassign */
725-
726712 return (
727713 < ListBox
728714 actions = { alignActions === ALIGNMENTS . TOP ? actions : null }
@@ -731,7 +717,7 @@ function DualListBox(props) {
731717 disabled = { disabled }
732718 filterValue = { filter [ controlKey ] }
733719 id = { id }
734- inputRef = { makeRef }
720+ inputRef = { mergeRefs ( [ ref , refProp ] ) }
735721 selections = { selections [ controlKey ] }
736722 showNoOptionsText = { showNoOptionsText }
737723 onDoubleClick = { wrapHandler ( onOptionDoubleClick ) }
0 commit comments