diff --git a/src/AsyncCreatable.js b/src/AsyncCreatable.js index 12b8ad540c..edc51ee10b 100644 --- a/src/AsyncCreatable.js +++ b/src/AsyncCreatable.js @@ -1,6 +1,15 @@ import React from 'react'; import Select from './Select'; +function reduce(obj, props = {}){ + return Object.keys(obj) + .reduce((props, key) => { + const value = obj[key]; + if (value !== undefined) props[key] = value; + return props; + }, props); +} + const AsyncCreatable = React.createClass({ displayName: 'AsyncCreatableSelect', @@ -11,12 +20,15 @@ const AsyncCreatable = React.createClass({ <Select.Creatable {...this.props}> {(creatableProps) => ( <Select - {...asyncProps} - {...creatableProps} + {...reduce(asyncProps, reduce(creatableProps, {}))} onInputChange={(input) => { creatableProps.onInputChange(input); return asyncProps.onInputChange(input); }} + ref={(ref) => { + creatableProps.ref(ref); + asyncProps.ref(ref); + }} /> )} </Select.Creatable>