[英]best way to create a flatlist with a button at the end? React Native with firebase
使用要添加到 Flatlist 末尾的按鈕創建一個單獨的組件。
然后在 Flatlist 的 'ListFooterComponent' prop 中調用這個組件。
這樣,在平面列表的末尾,您總會找到所需的按鈕。
下面是一個例子:
<FlatList
data={data}
renderItem={({ item }) => <ListItemComponent />
ListFooterComponent={() => <ButtonComponent />} // Add the button component here!
/>
flatlist 的“ListFooterComponent”道具中的按鈕組件包含您想要的位於 flatList 末尾的按鈕。
來自 ReactNative FlatList 文檔:
列表頁腳組件
呈現在所有項目的底部。 可以是 React 組件類、渲染函數或渲染元素。
有關詳細信息,你可以檢查出的ReactNative文檔Flatlist
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.