我在响应本机我的代码时遇到了 PropTypes 问题:
import React, { Component, PropTypes } from 'react';
import { Text } from 'react-native';
export default class Star extends Component {
render() {
return ( <Text> Hello </Text> );
}
}
Star.propTypes = {
fullStar: PropTypes.string.isRequired,
halfStar: PropTypes.string.isRequired,
emptyStar: PropTypes.string.isRequired,
half: PropTypes.bool,
count: PropTypes.number,
size: PropTypes.number,
}
Star.defaultProps = {
fullStar: "",
halfStar: "",
emtyStar: "",
half: 'true',
count: 5,
size: 30,
}
我的错误是 undefined is not an object (evaluating '_react2.PropTypes.string')
感谢阅读;)