Skip to content

Specify a ReactClass instead of the std input html tag#34

Open
vadmeste wants to merge 4 commits into
fmoo:masterfrom
vadmeste:reactclass_instead_of_std_html_tags
Open

Specify a ReactClass instead of the std input html tag#34
vadmeste wants to merge 4 commits into
fmoo:masterfrom
vadmeste:reactclass_instead_of_std_html_tags

Conversation

@vadmeste

@vadmeste vadmeste commented Mar 3, 2015

Copy link
Copy Markdown

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

@harshavardhana

Copy link
Copy Markdown

This is an really interesting stuff which i would use essentially at - https://github.com/Minio-io/polygon

@vadmeste

Copy link
Copy Markdown
Author

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 react/react#2374 which might lead us to conclude that is enough to test the react class against the function type

…d_of_std_html_tags

Conflicts:
	src/typeahead/index.js
…eactClass instead of the standard typeahead html input
@vadmeste

Copy link
Copy Markdown
Author

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..

@OtaK

OtaK commented Jun 13, 2015

Copy link
Copy Markdown
Contributor

Any news for the ability to provide custom element? I would like to be able to use Typeahead with a <textarea> element.

👍 on this PR.

@trshafer

Copy link
Copy Markdown
Collaborator

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.

@LoicPernod

Copy link
Copy Markdown
Contributor

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)

@LoicPernod

Copy link
Copy Markdown
Contributor

According to the documentation, the correct PropType for React Components is React.PropTypes.element
http://facebook.github.io/react/docs/reusable-components.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants