Fixed footer in react native with FlatList

不羁的心 提交于 2020-06-27 09:26:29

问题


Following this question on fixed footer with a ScrollView, I'm trying to implement a fixed footer on the screen with a FlatList. I have tried to use the answer provided by putting the flat list inside a view, but then none of the items are rendered. Does any one know how to implement a fixed footer with a flat list as the other main element of component?


回答1:


Using this flex solution I managed to do it with a couple of nested Views:

<View style={{flex: 1}}>
  <View style={{flex: 0.9}}>
    <FlatList/>
  </View>
  <View style={{flex: 0.1}}/>
</View>



回答2:


FlatList comes with footer support in the form of ListFooterComponent

Try adding something like this to your flatlist

ListFooterComponent={() => <Text>Footer content</Text>}

Hope this helps!



来源:https://stackoverflow.com/questions/49224471/fixed-footer-in-react-native-with-flatlist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!