我刚刚开始学习 React Native,这是我的第一个项目 - 新闻应用程序。不过,我已经使用 React Native Flatlist 成功渲染了新闻的图像和描述。
\n但是当我使用numColumns制作两列时,列号保持不变。但显示的图像数量变成了一半(即在我的例子中从 18 到 9)。而且图像的描述位于下一条新闻的图像下方,如下所示 -
\n
\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
我的源代码如下所示 -
\nimport React, { Component } from \'react\'\nimport { View, Text, FlatList, TouchableHighlight, SectionList, TouchableOpacity , Image,StyleSheet } from \'react-native\'\nimport { ScrollView } from \'react-native-gesture-handler\';\nimport { HomeNewsJSON } from "../../../../assects/JSON/Home"\n\nclass HomeNews extends Component {\n constructor(props) {\n super(props);\n this.state = {\n news: ""\n };\n }\n\n componentDidMount() {\n this.getInfo();\n }\n\n getInfo() {\n var data = []\n var jsondata = HomeNewsJSON["items"]\n …Run Code Online (Sandbox Code Playgroud) frontend listview rendering react-native react-native-flatlist