報錯 _react3.default.createClass is not a function
阿新 • • 發佈:2018-04-17
component point create sla contents 新版本 body values origin
這個是因為react最新版本拋棄使用了createClass這個函數,這個也是為了配合ES6 。這種情況下會報錯
var Popover = React.createClass({ | |
propTypes: { | |
isVisible: PropTypes.bool, | |
onClose: PropTypes.func, | |
}, | |
......... ........ ........ |
應修改為下面的寫法:
export default class Popover extends React.Component{
getInitialState() {
return {
contentSize: {},
anchorPoint: {},
popoverOrigin: {},
placement: ‘auto‘,
isTransitioning: false,
defaultAnimatedValues: {
scale: new Animated.Value(0),
translate: new Animated.ValueXY(),
fade: new Animated.Value(0),
},
};
}
報錯 _react3.default.createClass is not a function