我正在使用
FlashList
,但我有一个state
控制列表是否显示,我尝试了几种方法,但都给出了相同的结果FlashList's rendered size is not usable. Either the height or width is too small (<2px). Please make sure that the parent view of the list has a valid size. FlashList will match the size of the parent.
这是我的代码
<View
style={{
minHeight: 9,
minWidth: 9,
padding: 9,
}}
>
<FlashList
keyExtractor={({id}) => id}
data= cardOpen ? data: []}
estimatedItemSize={9}
extraData={cardOpen}
renderItem={({item}) => (
<OrderItemComponent item={item} expanded={cardOpen} />
)}
/>
有人吗?
按照 FlashList 文档,我们应该在具有硬编码高度样式数字的视图中使用它,如下所示:
<View style={{ height: Dimensions.get("screen").height-100, width: Dimensions.get("screen").width }}>
<FlashList
...
/>
</View>