React native 如何水平包装ScrollView内容?

React native 如何水平包装ScrollView内容?,react-native,React Native,我希望水平显示ScrollView的内容,并在它们到达右边缘时将其换行。比如说, |One Two Three Four Five| |Six Seven Eight Nine | |Ten | | | 其中垂直管道是屏幕的边缘 我尝试过弄乱ScrollView及其子项的flex样式,但遗憾的是,并没有任何效果。我还尝试在ScrollView上使用horizontal={true},但没有达到包装效果,我希望

我希望水平显示ScrollView的内容,并在它们到达右边缘时将其换行。比如说,

|One Two Three Four Five|
|Six Seven Eight Nine   |
|Ten                    |
|                       |
其中垂直管道是屏幕的边缘

我尝试过弄乱ScrollView及其子项的flex样式,但遗憾的是,并没有任何效果。我还尝试在ScrollView上使用
horizontal={true}
,但没有达到包装效果,我希望它可以垂直滚动

以下是我的代码的简化版本:

<ScrollView style={{flex: 1, flexDirection: "row", flexWrap: "wrap"}}>
  <View><Text>One</Text></View>
  <View><Text>Two</Text></View>
  <View><Text>Three</Text></View>
  ...
  <View><Text>Ten</Text></View>
</ScrollView>

如果能想到如何达到我想要的效果,我将不胜感激。谢谢

您只需在
ScrollView
上使用
contentContainerStyle
,而不是
style


...

你能试试FlatList和他的道具numColumns={5}吗?根据这份文件
|One                    |
|Two                    |
|Three                  |
|Four                   |
|Five                   |
|Six                    |
|Seven                  |
|Eight                  |
|Nine                   |
|Ten                    |
|                       |