React Native Undefined is not an object(evaluating ‘_react2.PropTypes.func’)
2018-01-08 15:09
2296 查看
我原来的写法
import React,
{ Component, PropTypes } from
'react';
export default class CommonTitle
extends Component {
render() {
return (
…
)
}
}
CommonTitle.propTypes = {
onTitleClick: PropTypes.func.isRequired
}
PropTypes 放在了react 中引入,但是还是出错
Undefined is not an object(evaluating ‘_react2.PropTypes.func’)
正确写法:
import React,
{ Component } from 'react';
import PropTypes from
'prop-types';
把PropTypes 从prop-types 中引入
import React,
{ Component, PropTypes } from
'react';
export default class CommonTitle
extends Component {
render() {
return (
…
)
}
}
CommonTitle.propTypes = {
onTitleClick: PropTypes.func.isRequired
}
PropTypes 放在了react 中引入,但是还是出错
Undefined is not an object(evaluating ‘_react2.PropTypes.func’)
正确写法:
import React,
{ Component } from 'react';
import PropTypes from
'prop-types';
把PropTypes 从prop-types 中引入
相关文章推荐
- React-Native 0.43.4 undefined is not an object (evaluating '_props[registrationName]') 正确的解决姿势
- React-Native之undefined is not an object
- 运行React Native示例出现null is not an object (evaluating 'this.state.text')
- React-native:Undefined is not an object
- react-native-baidu-map undefined is not an object(evaluting 'a.PropTypes.bool')
- React Native开发坑之null is not an object (evaluating 'inst.componentWillReceiveProps')
- undefined is not an object (evaluating 'this.props.nav.push')的解决过程
- undefined is not an object(evaluating 'ViewPropTypes.style')
- weex打包js集成到Android Studio TypeError: undefined is not an object (evaluating 'o.indexOf')
- undefined is not an object (evaluating 'this.props.navigator.push')
- undefined is not an object(evaluating '_react2.PropTypes.oneOfType')
- undefined is not an object (evaluating 'this.props.navigator.push')
- 【ReactNative】undefined is not an object(evaluating 'this.props.navigator')
- undefined is not an object (evaluating 'dataSource.rowIdentities')
- [ReactNative]undefined is not an object (evaluating 'ImagePickerManager.showImagePicker')
- ReactNative报错:undefined is not an object(evaluating 'RCTCameraRollManager.getPhotos')
- rn 0.38 升到0.42 后 android出的问题 undefined is not function evaluating globalObject.hasownproperty('promi
- An App ID with Identifier 'org.reactjs.native.example.Hello' is not available. Please enter a differ
- react 蜜汁state烦恼 【初始化state报错:null is not a object (evaluating ‘this.state.value’)】
- Java反射:object is not an instance of declaring c...