react-native run-android锛宼hen
error
undefined is not an object evaluating ReactPropTypes.string
Maybe you can check this https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html
@damiaozi maybe you are having the same issue as https://github.com/facebook/react-native/issues/14588 ? What version of RN are you?
the same problem here. Anybody has fixed the problem?
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
Component.propTypes = {
text: PropTypes.string.isRequired,
};
@cromasystem yes it works thanks. i have replaced React.PropTypes with PropTypes
@cromasystem do i have to do this for every component?
good quest @elvismercado
import PropTypes from 'prop-types';
worked for me !! Thanks
import PropTypes from 'prop-types';
This works for me too.
use
import React from 'react';
import PropTypes from 'prop-types';
what specific module or file did you change?? going nuts.. doing this...
@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';
Most helpful comment
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
}
}
Component.propTypes = {
text: PropTypes.string.isRequired,
};