// @flow import React from 'react'; import { ActivityIndicator, Dimensions, Image, ScrollView, Text, TouchableOpacity, View } from 'react-native'; import { TabView, SceneMap } from 'react-native-tab-view'; import { navigateBack } from 'utils/helper'; import Colors from 'styles/colors'; import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api import Button from 'component/button'; import Link from 'component/link'; import FileList from 'component/fileList'; import PageHeader from 'component/pageHeader'; import SubscribeButton from 'component/subscribeButton'; import SubscribeNotificationButton from 'component/subscribeNotificationButton'; import UriBar from 'component/uriBar'; import channelPageStyle from 'styles/channelPage'; class ChannelPage extends React.PureComponent { state = { page: 1, showPageButtons: false, activeTab: Constants.CONTENT_TAB, }; componentDidMount() { const { uri, page, claimsInChannel, fetchClaims, fetchClaimCount } = this.props; if (!claimsInChannel || !claimsInChannel.length) { fetchClaims(uri, page || this.state.page); } } handlePreviousPage = () => { const { uri, fetchClaims } = this.props; if (this.state.page > 1) { this.setState({ page: this.state.page - 1, showPageButtons: false }, () => { fetchClaims(uri, this.state.page); }); } }; handleNextPage = () => { const { uri, fetchClaims, totalPages } = this.props; if (this.state.page < totalPages) { this.setState({ page: this.state.page + 1, showPageButtons: false }, () => { fetchClaims(uri, this.state.page); }); } }; renderContent = () => { const { fetching, claimsInChannel, totalPages, navigation } = this.props; let contentList; if (fetching) { contentList = ( Fetching content... ); } else { contentList = claimsInChannel && claimsInChannel.length ? ( this.setState({ showPageButtons: true })} /> ) : ( No content found. ); } let pageButtons; if (totalPages > 1 && this.state.showPageButtons) { pageButtons = ( {this.state.page > 1 && (