我已经使用react-native-svg创建了一个矩形,并在该矩形中添加了一个flatList,它显示了所有的项目,但我无法滚动列表。请检查一下我是不是漏掉了什么?
<Svg style={styles.container}>
<Defs>
<LinearGradient id="grad" x1="0" y1="0" x2="1" y2="0.6">
<Stop offset="0" stopColor="red" stopOpacity="1" />
<Stop offset="1" stopColor="yellow" stopOpacity="1" />
</LinearGradient>
</Defs>
<Rect x="0" y="0" width="100%" height="100%" fill="url(#grad)"></Rect>
<FlatList
contentContainerStyle={styles.flatListContainer}
data={DATA}
renderItem={this.renderData}
horizontal
showsHorizontalScrollIndicator={false}
keyExtractor={(item) => item.id}
/>
</ScrollView>
</Svg>我也尝试将ScrollView添加到FlatList中,但不起作用。
<ScrollView>
<FlatList .../>
</ScrollView>(第一次尝试使用react-native-svg )
发布于 2020-08-02 16:29:56
添加样式
{flex : 1}在FlatList组件中。
https://stackoverflow.com/questions/63213496
复制相似问题