react-typeahead
react-typeahead copied to clipboard
Specify a ReactClass instead of the std input html tag
Since react-typeahead is a react library, this pull request helps the user to specifiy a react class in replacement of the standard input html tag, this pull request is not complete until the original idea is discussed
This is an really interesting stuff which i would use essentially at - https://github.com/Minio-io/polygon
it seems that React.PropTypes.instanceOf(ReactCompositeComponent) doesn't work, it shows this warning msg "Failed propType: invalid 'instanceof' operand expectedClass".
Also, I found this ticket https://github.com/facebook/react/issues/2374 which might lead us to conclude that is enough to test the react class against the function type
Well, when the developer want to use his own custom and complicated react class instead of the standard input element, inputQuerySel will help to specify which element that has to be treated by typeahead.. I will see if mixins could fit in this case..
Any news for the ability to provide custom element? I would like to be able to use Typeahead with a <textarea>
element.
:+1: on this PR.
ReactTransitionGroup uses component={component}
as the prop name when rendering a different component: https://facebook.github.io/react/docs/animation.html#rendering-a-different-component . Just a thought instead of CustomComponent
.
In the same vein, It would be interesting to be able to replace the TypeaheadSelector by a React component in order to add the possibility of different behaviors to it:
- Empty hint message,
- Complex views (for instance for a user typeahead, show some profile information)
According to the documentation, the correct PropType for React Components is React.PropTypes.element
http://facebook.github.io/react/docs/reusable-components.html