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

Validator deprecation in React 16 #2

Open
pronebird opened this issue Nov 8, 2016 · 8 comments
Open

Validator deprecation in React 16 #2

pronebird opened this issue Nov 8, 2016 · 8 comments

Comments

@pronebird
Copy link

Hey,

have you happened to see this warning in console?

Warning: You are manually calling a React.PropTypes validation function for the bar prop on Foo.create. This is deprecated and will not work in the next major version. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.

@NathanBWaters
Copy link
Collaborator

@pronebird I'm also seeing this.

@nealoke
Copy link

nealoke commented Mar 9, 2017

@tommikaikkonen any way to resolve this? :)

React docs info

@Ianc22
Copy link

Ianc22 commented May 4, 2017

@pronebird @NathanBWaters @nealoke

Guys, you can disable the validation via options:

import { Model } from 'redux-orm';
import { getPropTypesMixin } from 'redux-orm-proptypes';

const myPropTypesMixin = getPropTypesMixin({ validate: false, useDefaults: true});
const ValidatingModel = myPropTypesMixin(Model);

@nealoke
Copy link

nealoke commented May 4, 2017

@Ianc22 is the purpose of the redux-orm-proptypes not obsolete then? I want to validate it :)

@Ianc22
Copy link

Ianc22 commented May 4, 2017

@nealoke as far as validating goes I suppose it does.... I only just came across the issue myself and will look into it myself when I get a minute..

Validation only happens when not in production environment so I'll get back to it later once I got the orm up and running! Let me know how you get on ;)

@nealoke
Copy link

nealoke commented May 5, 2017

@Ianc22 Well to be honest I just threw it out of my models because of the errors. I would love to have it in but really don't know how to "fix" the code. I looked at it and realized that this was out of my knowledge :) Still very young on react etc. Maybe you can? 👍

@timrichd
Copy link

This is now an error in React 15

invariant.js:51 Uncaught Error: Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types
    at invariant (invariant.js:44)
    at checkType (factoryWithTypeCheckers.js:160)
    at validateProp (index.js:26)
    at index.js:42
    at _createBaseFor.js:17
    at baseForOwn (_baseForOwn.js:13)
    at forOwn (forOwn.js:33)
    at validateProps (index.js:41)
    at Function.create (index.js:117)
    at eval (eval at <anonymous> (models.js:116), <anonymous>:1:11)

@ojab
Copy link

ojab commented Oct 3, 2017

I've made a version that uses prop-types (see #4), so it works with react-16 and doesn't show deprecation warnings.
Validation failures are only logged into console since it's impossible to throw until facebook/prop-types#54 is merged.

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

6 participants