我需要你的帮助。如果我打开 Modal,它将使用 FlatList 显示所有鞋码。我添加了 removeClippedSubviews 但它不起作用。为什么?
...Modal...
<View style={{flexDirection: 'row', flexWrap: 'wrap'}}>
<FlatList
data={sizeShoes}
keyExtractor={item => item.key}
horizontal
getItemLayout={(data, index) => {
return {
index,
length: width * index,
offset: height * index
}
}}
showsHorizontalScrollIndicator={false}
renderItem={({ item }) => {
return (
<TouchableOpacity onPress={() => handleAddShoeSize(item.size)} style={{borderWidth: 1, borderColor: '#ccc', justifyContent: 'center', alignItems: 'center', borderRadius: 8, height: 50, width: 50, margin: 6, marginLeft: 0, backgroundColor: productSizeShoes.includes(item.size) ? '#ccc' : '#f1f1f1'}}>
<Text style={{color: productSizeShoes.includes(item.size) ? '#fff' : '#333', fontSize: 18}}>{item.size}</Text>
</TouchableOpacity>
)
}}
removeClippedSubviews={true} // Unmount components when outside of window
initialNumToRender={2} // Reduce initial render amount
disableVirtualization
legacyImplementation
maxToRenderPerBatch={1} // Reduce number in each render batch
updateCellsBatchingPeriod={100} // Increase time between renders
windowSize={7} // Reduce the window size
/>
</View>
...