Skip to content

Commit

Permalink
fix props passed to select
Browse files Browse the repository at this point in the history
  • Loading branch information
f0urfingeredfish committed Jun 28, 2017
1 parent 689211e commit 06bdffb
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 56 deletions.
12 changes: 1 addition & 11 deletions dist/react-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,6 @@ var _Select = require('./Select');

var _Select2 = _interopRequireDefault(_Select);

function reduce(obj) {
var props = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

return Object.keys(obj).reduce(function (props, key) {
var value = obj[key];
if (value !== undefined) props[key] = value;
return props;
}, props);
}

var AsyncCreatable = (0, _createReactClass2['default'])({
displayName: 'AsyncCreatableSelect',

Expand All @@ -315,7 +305,7 @@ var AsyncCreatable = (0, _createReactClass2['default'])({
_Select2['default'].Creatable,
_this.props,
function (creatableProps) {
return _react2['default'].createElement(_Select2['default'], _extends({}, reduce(asyncProps, reduce(creatableProps, {})), {
return _react2['default'].createElement(_Select2['default'], _extends({}, asyncProps, creatableProps, {
onInputChange: function (input) {
creatableProps.onInputChange(input);
return asyncProps.onInputChange(input);
Expand Down
4 changes: 2 additions & 2 deletions dist/react-select.min.js

Large diffs are not rendered by default.

12 changes: 1 addition & 11 deletions examples/dist/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,6 @@ var _Select = require('./Select');

var _Select2 = _interopRequireDefault(_Select);

function reduce(obj) {
var props = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

return Object.keys(obj).reduce(function (props, key) {
var value = obj[key];
if (value !== undefined) props[key] = value;
return props;
}, props);
}

var AsyncCreatable = (0, _createReactClass2['default'])({
displayName: 'AsyncCreatableSelect',

Expand All @@ -312,7 +302,7 @@ var AsyncCreatable = (0, _createReactClass2['default'])({
_Select2['default'].Creatable,
_this.props,
function (creatableProps) {
return _react2['default'].createElement(_Select2['default'], _extends({}, reduce(asyncProps, reduce(creatableProps, {})), {
return _react2['default'].createElement(_Select2['default'], _extends({}, asyncProps, creatableProps, {
onInputChange: function (input) {
creatableProps.onInputChange(input);
return asyncProps.onInputChange(input);
Expand Down
12 changes: 1 addition & 11 deletions examples/dist/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,6 @@ var _Select = require('./Select');

var _Select2 = _interopRequireDefault(_Select);

function reduce(obj) {
var props = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

return Object.keys(obj).reduce(function (props, key) {
var value = obj[key];
if (value !== undefined) props[key] = value;
return props;
}, props);
}

var AsyncCreatable = (0, _createReactClass2['default'])({
displayName: 'AsyncCreatableSelect',

Expand All @@ -315,7 +305,7 @@ var AsyncCreatable = (0, _createReactClass2['default'])({
_Select2['default'].Creatable,
_this.props,
function (creatableProps) {
return _react2['default'].createElement(_Select2['default'], _extends({}, reduce(asyncProps, reduce(creatableProps, {})), {
return _react2['default'].createElement(_Select2['default'], _extends({}, asyncProps, creatableProps, {
onInputChange: function (input) {
creatableProps.onInputChange(input);
return asyncProps.onInputChange(input);
Expand Down
12 changes: 1 addition & 11 deletions lib/AsyncCreatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ var _Select = require('./Select');

var _Select2 = _interopRequireDefault(_Select);

function reduce(obj) {
var props = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

return Object.keys(obj).reduce(function (props, key) {
var value = obj[key];
if (value !== undefined) props[key] = value;
return props;
}, props);
}

var AsyncCreatable = (0, _createReactClass2['default'])({
displayName: 'AsyncCreatableSelect',

Expand All @@ -44,7 +34,7 @@ var AsyncCreatable = (0, _createReactClass2['default'])({
_Select2['default'].Creatable,
_this.props,
function (creatableProps) {
return _react2['default'].createElement(_Select2['default'], _extends({}, reduce(asyncProps, reduce(creatableProps, {})), {
return _react2['default'].createElement(_Select2['default'], _extends({}, asyncProps, creatableProps, {
onInputChange: function (input) {
creatableProps.onInputChange(input);
return asyncProps.onInputChange(input);
Expand Down
12 changes: 2 additions & 10 deletions src/AsyncCreatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ import React from 'react';
import createClass from 'create-react-class';
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 = createClass({
displayName: 'AsyncCreatableSelect',

Expand All @@ -25,7 +16,8 @@ const AsyncCreatable = createClass({
<Select.Creatable {...this.props}>
{(creatableProps) => (
<Select
{...reduce(asyncProps, reduce(creatableProps, {}))}
{...asyncProps}
{...creatableProps}
onInputChange={(input) => {
creatableProps.onInputChange(input);
return asyncProps.onInputChange(input);
Expand Down

0 comments on commit 06bdffb

Please sign in to comment.