iOS:应用程序在发布模式下崩溃。错误:未定义不是对象(正在评估'a.View.propTypes.style')

时间:2018-09-17 13:19:15

标签: ios react-native react-proptypes xcode9.3

是的!与此相关的问题和答案很多,但是在每个解决方案中,所有人都说要用View.propTypes.style代替ViewPropTypes.style。但是在我的项目中,整个项目中没有View.propTypes.style代码可用。

如果在我的项目中View.propTypes.style不可用,那我可以在哪里替换?

完整错误:

undefined is not an object (evaluating 'a.View.propTypes.style')
 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 'a.View.propTypes.style')
[290:10014] Unhandled JS Exception: undefined is not an object (evaluating 'a.View.propTypes.style')
[290:10014] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: undefined is not an object (evaluating 'a.View.propTypes.style')', reason: 'Unhandled JS Exception: undefined is not an object (evaluating 'a.View.prop..., stack:
<unknown>@1022:1541
t@2:620

作为参考,我在下面使用了propTypes,但我认为这不是问题。

const propTypes = {
    data: PropTypes.array,
    onChange: PropTypes.func,
    initValue: PropTypes.string,
    style: ViewPropTypes.style,
    selectStyle: ViewPropTypes.style,
    optionStyle: ViewPropTypes.style,
    optionTextStyle: Text.propTypes.style,
    sectionStyle: ViewPropTypes.style,
    sectionTextStyle: Text.propTypes.style,
    cancelStyle: ViewPropTypes.style,
    cancelTextStyle: Text.propTypes.style,
    overlayStyle: ViewPropTypes.style,
    cancelText: PropTypes.string
};

0 个答案:

没有答案