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

feat(DatePicker): make onChange and value required #437

Merged
merged 4 commits into from
Apr 11, 2022

Conversation

tiagoalvesdulce
Copy link
Member

Closes #430

@victorgcramos victorgcramos changed the title feat(DatePicker): make onClick and value required feat(DatePicker): make onChange and value required Apr 7, 2022
Copy link
Member

@victorgcramos victorgcramos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some inline comments! Thanks!

Comment on lines 396 to 397
(fn.prototype.constructor.length < 2 &&
fn.prototype.constructor.length > 3)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the operator here is || 😁

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol. right!

onChange: function (props, propName) {
var fn = props[propName];
if (
!fn.prototype ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when onChange is null or undefined, the error message is:

Warning: Failed prop type: Cannot read properties of undefined (reading 'prototype')

I think we should also display the ... must be a function with 2 (if isMonthsMode is on) or 3 args. Args are: year, month and day. error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, will add that. thanks!

Copy link
Member

@victorgcramos victorgcramos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@victorgcramos victorgcramos merged commit a45931f into decred:master Apr 11, 2022
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

Successfully merging this pull request may close these issues.

[DatePicker] Make value and onChange props required
2 participants