作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 FlatList
组件,由 3 个部分组成:
<View style={{ flex: 1 }}>
<FlatList
ListHeaderComponent={Comp1}
ListFooterComponent={<Comp2 style={{ flexGrow: 1, justifyContent: 'flex-end' }}/>}
renderItem={Comp3}
contentContainerStyle={{ flexGrow: 1 }}
/>
</View>
ListFooterComponent
将在
ListHeaderComponent
之后立即呈现, 如果
data.length
是 0。
ListEmptyComponent
提供一个空 View 。 .在这种情况下,它看起来不错,直到我添加了至少一个项目 - 然后它再次粘在顶部。
ListFooterComponent
默认到底部?
FlatList
,红色 -
ListFooterComponent
最佳答案
如果它需要一直在屏幕底部,你可以将单独的部分包裹在一个 ScrollView 中
render() {
return (
<ScrollView style={{flex: 1}}>
<Comp1/>
<FlatList
style={{flex: 1}}
renderItem={Comp3}
/>
<Comp2/>
</ScrollView>
);
}
关于react-native - 如何将 ListFooterComponent 粘贴到屏幕底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54309242/
我对 Flatlist 有一个奇怪的问题,当我向下滚动时,我从 API 获取数据,我增加页面 +1 并在页脚中渲染一个微调器,但是当最后一页 == 当前页面时,这意味着没有数据出现,但微调器卡在底部,
我有一个 FlatList组件,由 3 个部分组成: } renderItem={Comp3} contentContainerStyle={{ flexGr
我是一名优秀的程序员,十分优秀!