Open jacobsmith opened 6 years ago
Due to some other business requirements, I ended up using https://github.com/reactjs/react-autocomplete instead. To achieve the same requirement of users selecting from the list, I implemented a validation of:
Typeahead.validateSelectedIsOneOf = (items, display) => {
return function(value) {
if (items.map((item) => display(item)).indexOf(value) < 0) {
return 'Please select from the list';
}
// ReduxForm expects "undefined" explicitly if no error is to be raised
return undefined; // eslint-disable-line no-undefined
};
};
It may or may not be useful to any future person who finds this issue.
I will leave the issue open as it still seems like either the documentation or the code is slightly mismatched, but feel free to close it if any maintainer sees fit.
Thanks!
Hello,
Thanks for this library! It's been very easy to pull down and get integrated. I did run into one issue:
The current README states that
allowCustomValues
is aboolean
prop that can be passed in ( https://github.com/fmoo/react-typeahead#propsallowcustomvalues ).However, when I have that set to
false
, I see the following in my console:I'd be more than happy to update documentation, but I wanted to check first what the intended use case is. My first impression was that if my list contains
['foo', 'bar']
and I typefooa
and click away, theonBlur
would set it back to empty (because I want to disallow entries that are not in the list). I'm not seeing that behavior, so figured I can write up some documentation with the results of this thread.Thanks!