react-native-page-scrollview icon indicating copy to clipboard operation
react-native-page-scrollview copied to clipboard

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

Open a728384698 opened this issue 5 years ago • 3 comments

截屏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都是一样的问题

a728384698 avatar Jun 23 '20 06:06 a728384698

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

alexsaurora avatar Aug 06 '20 06:08 alexsaurora

一样遇到这个问题

18638836174 avatar Nov 05 '20 08:11 18638836174

我通过修改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判断下

18638836174 avatar Nov 05 '20 09:11 18638836174