You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when I have that set to false, I see the following in my console:
Warning: Failed prop type: Invalid prop `allowCustomValues` of type `boolean` supplied to `Typeahead`, expected `number`.
in Typeahead (created by Typeahead)
in Typeahead (created by ConnectedField)
in ConnectedField (created by Connect(ConnectedField))
in Connect(ConnectedField) (created by Field)
...
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 type fooa and click away, the onBlur 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!
The text was updated successfully, but these errors were encountered:
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.
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!
The text was updated successfully, but these errors were encountered: