【发布时间】:2019-12-24 00:00:50
【问题描述】:
我正在尝试使用 highScores 的键和值创建一个 FlatList,将它们放在我的 ScrollView 中,但没有呈现...有什么问题?
import React from 'react';
import {
Platform,
ScrollView,
StyleSheet,
Text,
View,
FlatList,
Row
} from 'react-native';
export default function HomeScreen() {
const highScores = { '1': 'a', '2': 'b' };
return (
<View style={styles.container}>
<ScrollView
style={styles.container}
contentContainerStyle={styles.contentContainer}>
<View>
<FlatList
data={highScores}
renderItem={
({ item, index }) =>
<Row highScore={item} index={index} key={index} />
}
/>
</View>
);
}
如您所见,我创建了一个视图来渲染他的项目。我没有收到任何错误,但它不起作用。有人可以帮助我吗?谢谢!
【问题讨论】:
标签: react-native expo react-native-flatlist react-native-navigation