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

Update to react 16 createRef API #1602

Open
wants to merge 1 commit into
base: master
from

Conversation

@jeremyk
Copy link

commented Jan 16, 2019

I want to preface this by saying that I don't expect this to be merged right away. This is just what I needed to change to get this working for us. Would like to know if you are interested at all in this as a pull request and if so I can do some more work if needed to get it merged.

I am not sure how customInputRef is meant to work as any value but ref seems to result in a console warning.

What I want to do is pass in my own reference to the input so I can have access to the dom node to check its size. The createRef API works great but react-datepicker has not been updated and overwrites the ref I put on the custom input. I can work around this by passing a dummy value to customInputRef but that seems kind of silly and puts a warning in the console.

I am not sure how customInputRef is meant to work as any value but ref seems to result in a console warning.

What I want to do is pass in my own reference to the input so I can have access to the dom node to check its size. The createRef API works great but this has not been updated and overwrites the ref I put on the custom input. I can work around this by passing a dummy value to customInputRef but that seems kind of silly and puts a warning in the console.
@jeremyk

This comment has been minimized.

Copy link
Author

commented Jan 16, 2019

Hmm. I guess I could have used datepicker.input. I may switch to that while I wait to see if you want to upgrade react.

@martijnrusschen

This comment has been minimized.

Copy link
Member

commented Jan 19, 2019

Thanks for bringing this up. I think it would be good to move to the newer APIs as we only support React 16 and higher anyways.

@@ -80,7 +80,7 @@ export default class DatePicker extends React.Component {
children: PropTypes.node,
className: PropTypes.string,
customInput: PropTypes.element,
customInputRef: PropTypes.string,
inputRef: PropTypes.any,

This comment has been minimized.

Copy link
@lightbringer1991

lightbringer1991 May 2, 2019

I think we can use inputRef: PropTypes.shape({ current: PropTypes.instanceOf(Element) }).
IMO PropTypes.any seems a bit too much.
https://stackoverflow.com/a/51127130

@ericreis

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

Any news regarding this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.