Meituan-Dianping / beeshell

React Native 组件库
MIT License
1.8k stars 280 forks source link

Calendar报backgroundColor的解析错误 #32

Closed jolly-wu closed 5 years ago

jolly-wu commented 5 years ago

发现个问题,下面这个null赋值会导致崩溃: Calender的index.js的renderItem (item, date, desc) { return React.createElement( View, { style: [ styles.gridItem, { backgroundColor: desc.selected ? variables.mtdBrandPrimary : desc.today ? variables.mtdFillBody : null } ] },

wxlworkhard commented 5 years ago

经过测试最新版本,并没有你说的问题,具体怎么复现呢?

SuGod commented 5 years ago

确实有这个问题的。 华为mete20pro,android 9。

"beeshell": "^2.0.11",
"react": "16.6.3",
 "react-native": "0.57.8",

Calendar/index.js

Line: 170

backgroundColor: desc.selected ? variables.mtdBrandPrimary : (desc.today ? variables.mtdFillBody : null)

backgroundColor的值会得到null这时就是会报出这个错误,导致程序奔溃。 把null改成空串就不会报错了。

@wxlworkhard

SuGod commented 5 years ago

我目前的解决方案是 继承 Calendar组件 重写 renderItem 方法 ,什么都没改动 然后就好了。 我不确定问题出在哪里。 @wxlworkhard 你可以检查一下吗?