我正在使用 React Native 0.44.0,并尝试使用卡片样式布局制作水平 FlatList。无论出于何种原因,无论我做什么,我都无法激活水平模式。它似乎总是垂直渲染......
这是我正在使用的代码:
<FlatList
horizontal={true}
data={this.state.newsFeed}
refreshing={this.state.refreshing}
ref={ref => {
this.newsFeedListRef = ref;
}}
renderItem={this.renderNewsFeedRow.bind(this)}
keyExtractor={(item, index) => `feed_${index}`}
onRefresh={this.__handleNewsFeedOnRefresh.bind(this)}
renderScrollComponent={this.renderScrollComponent.bind(this)}
ListHeaderComponent={this.renderListHeaderComponent.bind(this)}
getItemLayout={(data, index) => ({
index,
length: ITEM_HEIGHT,
offset: ITEM_HEIGHT * index + headerBarHeight
})} />;
我可以发布组件渲染的代码,但除了样式的填充和边距之外,它们都没有使用任何内容,所以flex
or flexDirection
stuff.
尝试在平面列表标签中使用水平,而不是值,它对我有用:D
<FlatList
horizontal
data={tab_ad}
renderItem={(item) => this.renderItem(item.item)}
keyExtractor={(item, index) => index}
={this.state}
/>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)