diff --git a/examples/single.js b/examples/single.js
index f2452a964..ee04bb931 100644
--- a/examples/single.js
+++ b/examples/single.js
@@ -72,7 +72,7 @@ class Test extends React.Component {
jack
-
+
{[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((i) => {
diff --git a/package.json b/package.json
index 5620f9d6f..ecd13daf2 100644
--- a/package.json
+++ b/package.json
@@ -69,6 +69,7 @@
"classnames": "2.x",
"component-classes": "1.x",
"dom-scroll-into-view": "1.x",
+ "lodash.isequal": "^4.5.0",
"prop-types": "^15.5.8",
"rc-animate": "2.x",
"rc-menu": "^5.0.11",
diff --git a/src/Option.jsx b/src/Option.jsx
index 7b7151323..546a42628 100644
--- a/src/Option.jsx
+++ b/src/Option.jsx
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
export default class Option extends React.Component {
static propTypes = {
- value: PropTypes.string,
+ value: PropTypes.any,
};
static isSelectOption = true;
diff --git a/src/PropTypes.js b/src/PropTypes.js
index 2beb509e0..0801aa05a 100644
--- a/src/PropTypes.js
+++ b/src/PropTypes.js
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
function valueType(props, propName, componentName) {
const labelInValueShape = PropTypes.shape({
- key: PropTypes.string.isRequired,
+ key: PropTypes.any.isRequired,
label: PropTypes.string,
});
if (props.labelInValue) {
@@ -25,8 +25,8 @@ function valueType(props, propName, componentName) {
);
} else {
const validate = PropTypes.oneOfType([
- PropTypes.arrayOf(PropTypes.string),
- PropTypes.string,
+ PropTypes.arrayOf(PropTypes.any),
+ PropTypes.any,
]);
return validate(...arguments);
}
diff --git a/src/Select.jsx b/src/Select.jsx
index ce0a7191c..f7b363a35 100644
--- a/src/Select.jsx
+++ b/src/Select.jsx
@@ -22,11 +22,13 @@ import {
splitBySeparators,
findIndexInValueByLabel,
defaultFilterFn,
+ validateOptionValue,
} from './util';
import SelectTrigger from './SelectTrigger';
import { SelectPropTypes } from './PropTypes';
import { Item as MenuItem, ItemGroup as MenuItemGroup } from 'rc-menu';
import warning from 'warning';
+import isEqual from 'lodash.isequal';
function noop() {}
@@ -424,7 +426,7 @@ export default class Select extends React.Component {
if (maybe !== null) {
label = maybe;
}
- } else if (getValuePropValue(child) === value) {
+ } else if (isEqual(getValuePropValue(child), value)) {
label = this.getLabelFromOption(child);
}
});
@@ -895,6 +897,9 @@ export default class Select extends React.Component {
);
const childValue = getValuePropValue(child);
+
+ validateOptionValue(childValue, this.props);
+
if (this.filterOption(inputValue, child)) {
sel.push(