我并排有4个类别。这些类别中包含子类别。子类别用作垂直类别。 scrollToIndex
仅适用于最后一个类别!。按类别时我想水平滚动,按子类别时我想垂直滚动。
<ScrollView
ref={flatListRef}
/*onMomentumScrollEnd={event => {
dispatch(
OnChangeTextActionFunction({
props: 'catId',
value: parseFloat(
event.nativeEvent.contentOffset.x / screenWidth,
).toFixed(0),
}),
);
console.log(
parseFloat(event.nativeEvent.contentOffset.x / screenWidth).toFixed(
0,
),
);
}}*/
scrollEventThrottle={10}
pagingEnabled={true}
horizontal={true}>
{usedata.map((item, index) => {
return (
<FlatList
getItemLayout={getItemLayout}
ref={flatListRef2}
windowSize={10}
onEndReachedThreshold={50}
initialNumToRender={5}
removeClippedSubviews={true}
key={index}
data={item.SUBCAT}
renderItem={renderItem}
keyExtractor={item => item.SCID.toString()}
horizontal={false}
refreshControl={
<RefreshControl
colors={['#ff6211', '#2ecc71', 'blue']}
title="Pull to refresh"
tintColor="#fff"
titleColor="#fff"
refreshing={false}
onRefresh={handleRefresh}
/>
}
/>
);
})}
</ScrollView>