material-ui
material-ui copied to clipboard
AutoComplete: TypeError: key.includes is not a function
Hi,
I'm trying AutoComplete examples from the docs and I'm getting this error in console "TypeError: key.includes is not a function". It references line 59 in auto-complete.js. My code is simply:
<AutoComplete floatingLabelText = "floating Label" dataSource = {["12345", "23456", "34567"]} />
Am I doing something wrong?
PS. I ran the same the code again and there was no error. Maybe this was a problem with my browser or gulp.
I' ve encountered the same problem in Safari. I think simply String.inludes() is not supported, I've fixed it modifing the filter function in the path 'material-ui/lib/auto-complete.js' in this way:
filter: function filter(searchText, key, value) {
if (!String.prototype.includes) {
String.prototype.includes = function() {'use strict';
return String.prototype.indexOf.apply(this, arguments) !== -1;
};
}
return key.includes(searchText);
}