-
Notifications
You must be signed in to change notification settings - Fork 3k
refacto: [CalendarHeader, ExpandableCalendar] replace defaultProps with ES6 default parameters #2480
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
base: master
Are you sure you want to change the base?
Conversation
…h default parameters on components props
Would be nice to merge this to remove the console error; and to be up to date. |
can we get this reviewed? |
@@ -621,15 +621,4 @@ const ExpandableCalendar = (props: ExpandableCalendarProps) => { | |||
export default ExpandableCalendar; | |||
|
|||
ExpandableCalendar.displayName = 'ExpandableCalendar'; | |||
ExpandableCalendar.defaultProps = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we fill in the rest of these as well in src/calendar/header/index.tsx
? I think firstDay is the only one that's enumerated above so we maybe replace it withfirstDay = 0
.
Are the other props not used or why are they here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh looks like the other ones are ExpandableCalendar
props. I think we're also missing arrowsHitSlop
in CalendarHeader
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, all parameters are set correctly as far as I see.
Ping @nitzanyiz It includes some fix for new RN versions. |
The issue
As we can read see in this article : React 19 RC Upgrade Guide#removed-deprecated-react-apis
defaultProps
are being deprecated and won't be supported anymore with functional components in React 19Suggested Fix
Simply replace concerned functional components (
ExpandableCalendar
andCalendarHeader
) default props from with ES6 default parameters (some default parameters were already applied this way butdefaultProps
usage was remaining