updated a bit

This commit is contained in:
u-e 2018-12-25 18:10:51 +03:00
parent 9b6a686d22
commit 58078e1e11
2 changed files with 26 additions and 8 deletions

View File

@ -214,9 +214,14 @@ class PostsView extends Component {
isNoPost,
} = this.state;
const {
filterOptions, intl, isLoggedIn, getFor, isLoginDone, tag, isDarkTheme, handleOnScroll,
filterOptions,
intl,
isLoggedIn,
getFor,
isLoginDone,
tag,
isDarkTheme,
} = this.props;
/* eslint-disable */
return (
<View style={styles.container}>
@ -248,11 +253,13 @@ class PostsView extends Component {
)}
</Fragment>
{posts && posts.length > 0 && !isPostsLoading ? (
{posts && posts.length > 0 && !isPostsLoading && (
<FlatList
data={posts}
showsVerticalScrollIndicator={false}
renderItem={({ item }) => <PostCard isRefresh={refreshing} content={item} isHideImage={isHideImage} />}
renderItem={({ item }) => (
<PostCard isRefresh={refreshing} content={item} isHideImage={isHideImage} />
)}
keyExtractor={(post, index) => index.toString()}
onEndReached={() => this._loadPosts()}
removeClippedSubviews
@ -264,19 +271,21 @@ class PostsView extends Component {
onScrollBeginDrag={() => this._handleOnScrollStart()}
refreshControl={(
<RefreshControl
refreshing={this.state.refreshing}
refreshing={refreshing}
onRefresh={this._handleOnRefreshPosts}
progressBackgroundColor="#357CE6"
tintColor={!isDarkTheme ? '#357ce6' : '#96c0ff'}
titleColor="#fff"
colors={["#fff"]}
colors={['#fff']}
/>
)}
ref={(ref) => {
this.flatList = ref;
}}
/>
) : isNoPost ? (
)}
{isNoPost ? (
<NoPost
imageStyle={styles.noImage}
name={tag}

View File

@ -62,7 +62,7 @@ class ProfileContainer extends Component {
};
componentWillReceiveProps(nextProps) {
const { navigation, currentAccount, activeBottomTab } = this.props;
const { navigation, currentAccount, activeBottomTab, isLoggedIn } = this.props;
const currentUsername = currentAccount.name !== nextProps.currentAccount.name && nextProps.currentAccount.name;
const isParamsChange = nextProps.navigation.state
&& navigation.state
@ -70,6 +70,11 @@ class ProfileContainer extends Component {
&& nextProps.navigation.state.params.username
&& nextProps.navigation.state.params.username !== navigation.state.params.username;
if (isLoggedIn && !nextProps.isLoggedIn) {
navigation.navigate(ROUTES.SCREENS.LOGIN);
return;
}
if (currentUsername) {
this._loadProfile(currentUsername);
}
@ -83,6 +88,10 @@ class ProfileContainer extends Component {
this._loadProfile(selectedUser && selectedUser.username);
}
}
_getReplies = async (user) => {