如何修复TypeError null不是onject(评估“ item.rating_stars.length”)

时间:2019-05-06 02:12:03

标签: android react-native typeerror

我在调试react-native应用程序时收到此错误,它是一个连接到wordpress网站的目录,它显示列表,并且一切都很好,但是当您单击类别或尝试搜索或查看所有列表时,我得到这个错误

enter image description here

我尝试修复此错误,一直跟踪代码,直到到达SearchingView.js中的这一行为止

<View style={styles.gradingCon}>
                                                                    <Grading
                                                                        mode="stars"
                                                                        scale={1}
                                                                        score={item.rating_stars.length === 0 ? 0 : item.rating_stars}
                                                                        scoreBase={5}
                                                                        activeColor={COLOR_ORANGE}
                                                                        defaultColor={COLOR_GRAY}
                                                                    />
                                                                </View>

但是我被困在这里,不确定下一步该怎么做

0 个答案:

没有答案