Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get ref of actual input field #359

Closed
swrobel opened this issue Jul 12, 2018 · 3 comments
Closed

Cannot get ref of actual input field #359

swrobel opened this issue Jul 12, 2018 · 3 comments

Comments

@swrobel
Copy link

swrobel commented Jul 12, 2018

Version

3.1.5

Steps to reproduce

<Typeahead
   inputRef={i => (this.input = i)}
/>

Expected Behavior

this.input is the dom <input> element.

Actual Behavior

this.input is undefined

@ericgio
Copy link
Owner

ericgio commented Jul 12, 2018

The behavior you're describing is expected, since inputRef is not part of the API. Is this a feature request?

@swrobel
Copy link
Author

swrobel commented Jul 12, 2018

In that case, I guess it is.

@ericgio
Copy link
Owner

ericgio commented Jul 12, 2018

You can call getInput on the typeahead instance if you need the input node:

// In `render`:
<Typeahead
  ...
  ref={typeahead => this.typeahead = typeahead}
/>

// In some handler:
this.typeahead.getInstance().getInput();

@ericgio ericgio closed this as completed Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants