Misc tweaks and fixes ()

* channel icon auto thumbs. fix infinite claim list reload.
* tweak last page check
* additional tweaks and fixes before release
This commit is contained in:
Akinwale Ariwodola 2019-08-11 08:52:17 +01:00 committed by GitHub
parent 89222bc9ee
commit 38618080a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 212 additions and 119 deletions
src/component/claimList

View file

@ -22,6 +22,7 @@ class ClaimList extends React.PureComponent {
currentPage: 1, // initial page load is page 1
subscriptionsView: false, // whether or not this claim list is for subscriptions
trendingForAllView: false,
lastPageReached: false,
};
componentDidMount() {
@ -73,9 +74,10 @@ class ClaimList extends React.PureComponent {
channelIds: prevChannelIds,
trendingForAll: prevTrendingForAll,
time: prevTime,
claimSearchUris: prevClaimSearchUris,
showNsfwContent,
} = this.props;
const { orderBy, tags, channelIds, trendingForAll, time } = nextProps;
const { orderBy, tags, channelIds, trendingForAll, time, claimSearchUris } = nextProps;
if (
!_.isEqual(orderBy, prevOrderBy) ||
!_.isEqual(tags, prevTags) ||
@ -119,6 +121,18 @@ class ClaimList extends React.PureComponent {
}
});
}
if (
(this.state.subscriptionsView || this.state.trendingForAllView) &&
this.state.currentPage > 1 &&
prevClaimSearchUris &&
prevClaimSearchUris.length > 0 &&
_.isEqual(prevClaimSearchUris, claimSearchUris)
) {
this.setState({ lastPageReached: true });
} else {
this.setState({ lastPageReached: false });
}
}
getReleaseTimeOption = time => {
@ -130,6 +144,10 @@ class ClaimList extends React.PureComponent {
};
handleVerticalEndReached = () => {
if (this.state.lastPageReached) {
return;
}
// fetch more content
const {
channelIds,
@ -240,6 +258,17 @@ class ClaimList extends React.PureComponent {
if (Constants.ORIENTATION_VERTICAL === orientation) {
const data = subscriptionsView || trendingForAllView ? claimSearchUris : uris;
if (!loading && !claimSearchLoading && (!data || data.length === 0)) {
return (
<View style={style}>
<Text style={claimListStyle.noContentText}>
No content to display at this time. Please check back later.
</Text>
</View>
);
}
return (
<View style={style}>
<FlatList