【发布时间】:2019-05-19 17:15:38
【问题描述】:
我在一个屏幕中有一个静态组件和许多 for 循环渲染的组件。
这里的所有代码。
import React from "react";
import { View, Text, FlatList } from "react-native";
...
class FlatListScrollWithStatic extends React.Component {
render() {
return (
<View style={{ flex: 1 }}>
<FriendsTop /> // the static component
<FlatList
style={{ flex: 1 }}
data={this.props.friendsCard}
renderItem={({ item }) => <FriendsCard {...item} />} // the for loop rendered components
keyExtractor={(item, index) => index.toString()}
/>
</View>
);
}
}
现在我想将 FriendsTop 迁移到 Flatlist 中,让它随着渲染的组件滚动,我应该如何更改我的代码?
【问题讨论】:
标签: javascript react-native react-native-flatlist