React-datepicker: Support React 16

Created on 27 Jul 2017  ยท  13Comments  ยท  Source: Hacker0x01/react-datepicker

Datepicker is not working with React 16.0.0 Beta 1. I was getting errors on PropTypes in the react-datepicker.min.js file.

Most helpful comment

for notoriety of the impact of this issue: +1 (emoticon) if this is preventing you from using React 16 (now that it's released)

All 13 comments

Can you be more specific and post the errors here?

Figure out it was a webpack include issue with an older version.

We must update proptypes package:

import React from 'react'
import PropTypes from 'prop-types'

I think this is going to be trickier than just updating the proptypes package. React is declared as a peer dependency supporting two different major versions (0.x and 15.x). Ideally, the package versions of react and prop-types should match. I'm not exactly sure if there's some dependency combination that ensures that. I'm reopening this issue so that we can figure out a solution.

FWIW, We're currently on React 15.1.0, which doesn't use the prop-types package. The only harm in using components that use the prop-types package seems to be that we get deprecation warnings about how calling prop types directly is not supported. (They're somewhat misleading in that they blame the render method of a component rather than blaming React itself for the deprecated invocation.)

I do not know how it interacts with 0.14.

Do we actually support 0.14? The README would appear to indicate 15.5 is required for newer versions of react-datepicker, though package.json still says ^0.14.0 || ^15.0.0.

for notoriety of the impact of this issue: +1 (emoticon) if this is preventing you from using React 16 (now that it's released)

Any workaround to make it work with react 16? This is the only incompatible library that I have in my dependencies

There is an open PR to add compatibility with react v16 here: https://github.com/Hacker0x01/react-datepicker/pull/1047 @martijnrusschen @rafeememon would you have some time to take a look?

I'm also having issues with React 16:

image

Looks like https://github.com/souporserious/react-popper/pull/59 is merged, so updating to the latest version will resolve the issue.

Still Its giving error with react 16 , am i missing anything

toms-Macbook:~ tom$ cd fireworks/
toms-Macbook:fireworks tom$ clear
toms-Macbook:fireworks tom$ mkdir myproject
toms-Macbook:fireworks tom$ cd myproject/
toms-Macbook:myproject tom$ npm init -y
toms-Macbook:myproject tom$ npm install react react-dom react-datepicker --save
[email protected] /Users/tom/fireworks/myproject
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [email protected]
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [email protected]
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [email protected]
โ”‚ โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [email protected]
โ”‚ โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”‚ โ””โ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ””โ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ””โ”€โ”€ [email protected]
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ *UNMET PEER DEPENDENCY react@^15.5.x
โ”‚ โ”œโ”€โ”€ UNMET PEER DEPENDENCY react-dom@^15.5.x
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚   โ””โ”€โ”€ [email protected]
โ””โ”€โ”€ [email protected]

npm WARN [email protected] requires a peer of react@^15.5.x but none was installed.
npm WARN [email protected] requires a peer of react-dom@^15.5.x but none was installed.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

@martijnrusschen Can we get a release for this published out to npm?

Done.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ahribori picture ahribori  ยท  3Comments

sarav1234 picture sarav1234  ยท  3Comments

lclemence picture lclemence  ยท  3Comments

pinturic picture pinturic  ยท  3Comments

kkras3 picture kkras3  ยท  3Comments