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

"Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead" #725

Closed
wle8300 opened this issue Apr 21, 2017 · 18 comments

Comments

@wle8300
Copy link

wle8300 commented Apr 21, 2017

I'm getting this error. I believe the warning is originating from either:

a) styled-components
b) one of its deps

I'm using create-react-app and my only added dep is styled-components. Removing styled-components makes the warning message go away.

@k15a
Copy link
Member

k15a commented Apr 23, 2017

That's already fixed in master and v2. Just needs to be published.

@k15a k15a closed this as completed Apr 23, 2017
@nic
Copy link

nic commented Apr 23, 2017

Reference: #668

@rovansteen
Copy link

@k15a this should be fixed in 1.4.5 right? At least that's what the changelog says, still getting the warning tho.

If I look where it's coming from: styled-components/lib/types.js which contains the following compiled code:

"use strict";

/* todo: I want this to actually be an array of Function | string but that causes errors */
Object.defineProperty(module.exports, "babelPluginFlowReactPropTypes_proptype_GlamorRule", {
  value: require("react").PropTypes.shape({
    cssText: require("react").PropTypes.string.isRequired
  })
});

/* eslint-disable no-undef */

@kitten
Copy link
Member

kitten commented Apr 24, 2017

@rovansteen that explains a lot actually! Thanks!
We should maybe just remove the plugin. As far as I know it's not doing anything for us anyway

@jeffscottward
Copy link

jeffscottward commented Apr 28, 2017

.... sooo ... you gonna fix it now? @philpl

@kitten
Copy link
Member

kitten commented Apr 28, 2017

@jeffscottward should be fixed with the new version of babel-plugin-flow-react-proptypes in v2 RC

@kachkaev
Copy link
Member

kachkaev commented Apr 29, 2017

It’d be great to see a new release in 1.x branch with this fix too. Could anyone please release 1.4.6?

@kolelee4
Copy link

kolelee4 commented May 1, 2017

I'm still getting this warning. @jeffscottward How did you get around this?

@jeffscottward
Copy link

I went through the whole lib folder and replaced the require('react').PropTypes with
var PropTypes = require('prop-types');
Proptypes.blahbblah

Here is the folder zipped up
styled-components.zip

@wle8300
Copy link
Author

wle8300 commented May 2, 2017

@jeffscottward probably not the best idea because the new release will overwrite everything

@kolelee4
Copy link

kolelee4 commented May 2, 2017

@jeffscottward Thank you. @williamle8300 When is the next release?

@wle8300
Copy link
Author

wle8300 commented May 2, 2017 via email

@kachkaev
Copy link
Member

kachkaev commented May 2, 2017

@k15a @philpl @geelen could you please reopen this issue meanwhile and even maybe release 1.4.x? There must be thousands of devs who see the warning now 😃

Switching to v2 until it’s stable is something most of us would probably prefer to avoid.

@k15a k15a reopened this May 2, 2017
@kitten
Copy link
Member

kitten commented May 2, 2017

@kachkaev This should be fixed with the 1.4.6 release which has just gone out 😄

@kitten kitten closed this as completed May 2, 2017
@jeffscottward
Copy link

@williamle8300 "waiting to cut a realease" is not an option in a production environment. I would appreciate you didn't down vote people who come up with a temporary emergency fix and share it with the community.

@wle8300
Copy link
Author

wle8300 commented May 2, 2017 via email

@kitten
Copy link
Member

kitten commented May 2, 2017

@jeffscottward @williamle8300 As our code of conduct states, we expect respectful conversations amongst members of our community. Please refrain from derogatory remarks. https://github.com/styled-components/styled-components/blob/master/CODE_OF_CONDUCT.md

@wle8300
Copy link
Author

wle8300 commented May 3, 2017

@philpl Edited my comment.

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

No branches or pull requests

8 participants