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

undefined is not an object evaluating ReactPropTypes.string #14590

Closed
damiaozi opened this issue Jun 19, 2017 · 13 comments
Closed

undefined is not an object evaluating ReactPropTypes.string #14590

damiaozi opened this issue Jun 19, 2017 · 13 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@damiaozi
Copy link

react-native run-android,then
error
undefined is not an object evaluating ReactPropTypes.string

@AriaEdo
Copy link

AriaEdo commented Jun 19, 2017

Maybe you can check this https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html

@bartolkaruza
Copy link

@damiaozi maybe you are having the same issue as #14588 ? What version of RN are you?

@DavitVosk
Copy link

the same problem here. Anybody has fixed the problem?

@masoodaslami
Copy link

After version 15.5 you have to import PropTypes from prop-types like below:

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

class Component extends React.Component {
render() {
return

{this.props.text}
;
}
}

Component.propTypes = {
text: PropTypes.string.isRequired,
};

@sachinwak
Copy link

@cromasystem yes it works thanks. i have replaced React.PropTypes with PropTypes

@elvismercado
Copy link

@cromasystem do i have to do this for every component?

@AlbertIntelligence
Copy link

good quest @elvismercado

@KothariShridutt
Copy link

KothariShridutt commented Dec 5, 2017

import PropTypes from 'prop-types';

worked for me !! Thanks

@theebi
Copy link

theebi commented Jan 10, 2018

import PropTypes from 'prop-types';
This works for me too.

@vishakha-shah
Copy link

vishakha-shah commented Jan 17, 2018

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

@wanghuajian620
Copy link

screen shot 2018-01-22 at 4 23 15 pm

linktylr added a commit to linktylr/react-native-day-planner that referenced this issue Apr 28, 2018
Version 15.5 of React Native changes how PropTypes are imported.

Old: 
const {
  PropTypes,
} = React;

New:
import PropTypes from 'prop-types';

Without this fix you will receive the red screen error message "undefined is not an object evaluating ReactPropTypes.string".

Explanation here: facebook/react-native#14590
linktylr added a commit to linktylr/react-native-day-planner that referenced this issue Apr 28, 2018
@Shazam14
Copy link

Shazam14 commented Jun 1, 2018

what specific module or file did you change?? going nuts.. doing this...

@tannerhallman
Copy link

tannerhallman commented Jun 12, 2018

@Shazam14 you will have to make the change in both your modules and those modules of the libraries you have declared in your package.json. There's a lot of pull requests waiting to merge these fixes into various libraries that I've run into, but until those are merged and packaged for deployment, you will have to make the temporary fix yourself.

For instance, you will need to change:

import React, { Component , PropTypes } from 'react';
to
import React, { Component } from 'react';
import PropTypes from 'prop-types';

@facebook facebook locked as resolved and limited conversation to collaborators Jun 19, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests