forked from JedWatson/react-select
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Cema edited this page Mar 28, 2016
·
2 revisions
Welcome to the react-select wiki!
In order to add CSS styles for React Select use:
require('react-select/less/default.less')
or
require('react-select/dist/default.css')
see https://github.com/JedWatson/react-select/issues/176
Until allowCreate={true}
option doesn't fixed and merged, use one of these solutions:
- https://github.com/lefnire/jobpig/commit/ce4bf390f47f41683f1d253c28dc748b14287d67
- https://github.com/JedWatson/react-select/pull/660#issuecomment-169249033
- filterOptions function:
filterOptions = (options, filter, values) => {
// Filter already selected values
let filteredOptions = options.filter(option => {
return !(values.includes(option));
});
// Filter by label
if (filter !== undefined && filter != null && filter.length > 0) {
filteredOptions = filteredOptions.filter(option => {
return RegExp(filter, 'ig').test(option.label);
});
}
// Append Addition option
if (filteredOptions.length == 0) {
filteredOptions.push({
label: <span><strong>Create</strong>: {filter}</span>,
value: filter,
create: true,
});
}
return filteredOptions;
};
For more information, see: https://github.com/JedWatson/react-select/pull/660