geek-prince / react-native-page-scrollview

对ScrollView的封装,可以很方便的实现水平,垂直分页轮播效果.而且可以自定义分页宽高,和侧边View的旋转,透明度,大小等.
MIT License
73 stars 25 forks source link

Invariant Violation: [657,"RCTView",81,{"width":"<<NaN>>","height":0,"backgroundColor":0}] is not usable as a native method argument #11

Open a728384698 opened 4 years ago

a728384698 commented 4 years ago

截屏2020-06-23下午2 44 47 截屏2020-06-23下午2 45 07 截屏2020-06-23下午2 45 35 有截图但是好像我这边预览不到,提交下代码 render() { let imgArr = [ { uri: 'https://img.xyj321.com/attatch/2020061510_bc7597875cb6444d2131d23f5e7fde39.jpg', }, ]; return ( <PageScrollView style={{width: deviceDpWidth, height: (deviceDpWidth / 16) 9}} builtinStyle="sizeChangeMode" builtinWH={{width: 300, height: (300 / 16) 9}} imageArr={imgArr} />)}

"react": "16.9.0",
"react-native": "0.61.4",

不管什么样式都是这个问题,直接copy的代码还是这个错误;设置没设置builtinWH,style都是一样的问题

alexsaurora commented 4 years ago

我也遇到了同样的问题,请问你解决了吗?

18638836174 commented 3 years ago

一样遇到这个问题

18638836174 commented 3 years ago

我通过修改node_module/react-native-page-scrollwiew/PageScrollView.js下解决了ios端的这个报错

  1. 325行修改为: arr.push(<View key={-2} style={{width:isNaN((viewWidth-width)/2)?0:(viewWidth-width)/2,height:viewHeight,backgroundColor:'#0000'}}/>);
  2. 377行修改为: arr.push(<View key={-3} style={{width:isNaN((viewWidth-width)/2)?0:(viewWidth-width)/2,height:viewHeight,backgroundColor:'#0000'}}/>);

我用的是横向排列,估计纵向排列依然是这问题,把对应报错的位置用isNaN判断下