React Native 自定义组件报错 has no propType for native prop
发布时间:2020-12-15 08:26:51 所属栏目:百科 来源:网络整理
导读:在使用自定义UI组件时,定义JS组件报如下错误 has no propType for native prop .If you haven't changed this prop yourself,this usually means that your versions of the native code andr JavaScript code are out of sync. Updating both should make
在使用自定义UI组件时,定义JS组件报如下错误 has no propType for native prop.
If you haven't changed this prop yourself,this usually means that your versions of the native code andr JavaScript code are out of sync. Updating both should make this error go away.
解决办法就是在定义js组件属性时,加…View.propTypes var VideoView = {
name:'VideoView',propTypes:{
style: View.propTypes.style,source:PropTypes.shape({
url:PropTypes.string,headers:PropTypes.object,}),...View.propTypes,//包含默认的View的属性,如果没有这句会报‘has no propType for native prop’错误
}
}; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |