stephy / CalendarPicker

CalendarPicker Component for React Native
807 stars 372 forks source link

Support for defaultProps #383

Closed AjnaSofthouse closed 3 months ago

AjnaSofthouse commented 6 months ago

Warning: Day: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. in Day

thomas-hs commented 6 months ago

I'm experiencing the same issue is there a way to resolve this?

thomas-hs commented 6 months ago

Hi, are there any updates on this?

haastrupea commented 4 months ago

I am facing this issue as well, a little digging around, I found out that Day.defaultProps way of setting default will soon be removed in React Native in favour of new functionality in both JavaScript and React Native

it is now possible to set default directly like this

function(props = {}){
const {prop1 = [], prop2={}} = props
}

I found that Day.js file on 256 is using the soon-to-be-removed Day.defaultProps

Proposed solution

A PR removing every reference to defaultProps in the project and replacing them with a JavaScript way of setting the default

If this is okay, I can submit PR by the weekend. If anyone can do it way faster, It would be awesome

haastrupea commented 4 months ago

I assume since no one is taking this up, I will go ahead and submit a Pr to fix this.

asieraduriz commented 4 months ago

Sorry @haastrupea , I wasn't patient enough and I went ahead to update the functional component. I also did a quick search, and this is the only functional component with default props, so I'm only changing it

peacechen commented 3 months ago

Published 8.0.5

Thanks @haastrupea and @asieraduriz for the fix