react-navigation#FlatList JavaScript Examples
The following examples show how to use
react-navigation#FlatList.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: chats.js From haven with MIT License | 6 votes |
render() {
const { chats, navigation } = this.props;
const filteredData = this.filterChats();
// const { tab } = this.state;
return (
<View style={styles.bgWrapper}>
<TabHeader
left={<NavPlusButton />}
onLeft={this.toNewChat}
title="Chat"
navigation={navigation}
/>
{/* <Tabs
currentTab={tab}
tabs={chatTabs}
onChange={this.updateChatFilter}
withBorder
/> */}
<FlatList
ListEmptyComponent={this.renderEmptyState()}
contentContainerStyle={isEmpty(filteredData) ? styles.emptyStateStyle : null}
data={filteredData}
keyExtractor={(item, index) => `chat_item_${index}`}
renderItem={this.renderItem}
refreshControl={<RefreshControl refreshing={chats.loading} onRefresh={this.onRefresh} />}
/>
</View>
);
}
Example #2
Source File: GlobalFeed.js From haven with MIT License | 5 votes |
render() {
const { feedList, sort, onChangeSortOption, currentStatus } = this.props;
const { imagesForModal, reported } = this.state;
return (
<View style={{ flex: 1 }}>
<FlatList
ref={this.setListRef}
data={feedList}
keyExtractor={this.keyExtractor}
renderItem={this.renderItem}
refreshControl={
<RefreshControl refreshing={currentStatus === streamActions.refreshStream} onRefresh={this.handleRefresh} />
}
onEndReachedThreshold={0.9}
onEndReached={this.handleLoad}
ListHeaderComponent={<OptionSelector currentOption={sort} options={sortOptions} onChange={onChangeSortOption} />}
ListEmptyComponent={this.renderEmptyState}
ListFooterComponent={this.renderFooter}
/>
<OBDarkModal
onRequestClose={this.handleClose}
visible={imagesForModal.length > 0}
darkContent
>
<ImageViewer
imageUrls={imagesForModal}
enableSwipeDown
enablePreload
onCancel={this.handleClose}
/>
<ModalBackButton onPress={this.handleClose} />
</OBDarkModal>
{reported && (
<View style={styles.overlay}>
<Text style={styles.overlayText}>
Reported
</Text>
</View>
)}
<RepostTemplate ref={this.setRepostTemplateRef} />
<ReportTemplate ref={this.setReportTemplateRef} submit={this.submitReport} />
</View>
);
}