我需要禁用父级FlatList
的滚动(滚动将通过按下按钮来实现)并激活子级的滚动FlatList
。scrollEnabled={false}
由于我为父级设置的事实,FlatList
滚动不适用于子级Flatlist
。如何解决这个问题呢?
const data = [
{ type: 'list', data: ['Apple', 'Banna', 'Pear', 'Orange', 'Grape', 'Pineapple']},
{ type: 'list', data: ['Bike', 'Car', 'Train', 'Plane', 'Boat', 'Rocket']}
];
return (
<FlatList
data={data}
keyExtractor={item => item.id}
renderItem={({item}) => {
return <FlatList
data={item.data}
keyExtractor={item => item.id}
numColumns={item.data.length} // horizontal
renderItem={({item}) => (
<View style={{width: width, height: 50, alignItems: 'center', justifyContent: 'center'}}>
<Text>{item}</Text>
</View>
)
}
pagingEnabled
/>
}}
horizontal
pagingEnabled
scrollEnabled={false}
/>
);