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

findDOMNode is deprecated; need to use a ref #166

Open
joefiorini opened this issue Jan 7, 2019 · 3 comments
Open

findDOMNode is deprecated; need to use a ref #166

joefiorini opened this issue Jan 7, 2019 · 3 comments

Comments

@joefiorini
Copy link

Going to try to open a PR for this, but wanted to bring it up in an issue first. findDOMNode is deprecated in favor of refs. I think the safest way to fix this would be to create a single ref that is used in one of two ways:

  1. When using a render prop, pass the ref into the render prop function and require the developer to pass it down to their input (I believe there is precedence for this in other libraries, but need to verify that...)
  2. When not using a render prop, pass the ref straight to the default input that is controlled directly by the input mask component.

I'm going to try this and see what it does to the tests. If it works out, I'll open a PR for it, unless I hear objections here.

@De-Santa
Copy link

De-Santa commented Jan 21, 2019

Need this feature to. Im using react-input-mask with react-datepicker and datepicker passes own onFocus handler to input. But my custom input wrapped inside with <div>, so I need input ref to handle focus properly.
If I get ref as suggested in closed issues:
ref={ref => this.input = findDOMNode(ref)}
I get next eslint warns:
image
So it don`t feels like clean solution

@skaziweb
Copy link

skaziweb commented Mar 27, 2020

<React.StrictMode>

</React.StrictMode>

@Temirtator
Copy link

Temirtator commented Apr 6, 2021

I have the same problem. I send PR to fix this issue.

#255

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

4 participants