mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 12:51:42 +03:00
Fixed profile page refreshing issue
This commit is contained in:
parent
c7783aa24b
commit
b8b019c33e
@ -47,11 +47,12 @@ class PostsView extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
const { currentAccountUsername } = this.props;
|
const { currentAccountUsername, changeForceLoadPostState } = this.props;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
currentAccountUsername !== nextProps.currentAccountUsername &&
|
(currentAccountUsername !== nextProps.currentAccountUsername &&
|
||||||
nextProps.currentAccountUsername
|
nextProps.currentAccountUsername) ||
|
||||||
|
nextProps.forceLoadPost
|
||||||
) {
|
) {
|
||||||
// Set all initial data (New user new rules)
|
// Set all initial data (New user new rules)
|
||||||
this.setState(
|
this.setState(
|
||||||
@ -68,6 +69,9 @@ class PostsView extends Component {
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this._loadPosts();
|
this._loadPosts();
|
||||||
|
if (changeForceLoadPostState) {
|
||||||
|
changeForceLoadPostState(false);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -281,7 +285,7 @@ class PostsView extends Component {
|
|||||||
tintColor={!isDarkTheme ? '#357ce6' : '#96c0ff'}
|
tintColor={!isDarkTheme ? '#357ce6' : '#96c0ff'}
|
||||||
titleColor="#fff"
|
titleColor="#fff"
|
||||||
colors={['#fff']}
|
colors={['#fff']}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
ref={ref => {
|
ref={ref => {
|
||||||
this.flatList = ref;
|
this.flatList = ref;
|
||||||
|
@ -44,6 +44,7 @@ class ProfileContainer extends Component {
|
|||||||
isReverseHeader,
|
isReverseHeader,
|
||||||
user: null,
|
user: null,
|
||||||
selectedQuickProfile: null,
|
selectedQuickProfile: null,
|
||||||
|
forceLoadPost: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ class ProfileContainer extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
const { navigation, currentAccount, activeBottomTab, isLoggedIn } = this.props;
|
const { activeBottomTab, currentAccount, isLoggedIn, navigation } = this.props;
|
||||||
const currentUsername =
|
const currentUsername =
|
||||||
currentAccount.name !== nextProps.currentAccount.name && nextProps.currentAccount.name;
|
currentAccount.name !== nextProps.currentAccount.name && nextProps.currentAccount.name;
|
||||||
|
|
||||||
@ -84,15 +85,13 @@ class ProfileContainer extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentUsername) {
|
|
||||||
this._loadProfile(currentUsername);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
activeBottomTab !== nextProps.activeBottomTab &&
|
(activeBottomTab !== nextProps.activeBottomTab &&
|
||||||
nextProps.activeBottomTab === 'ProfileTabbar'
|
nextProps.activeBottomTab === ROUTES.TABBAR.PROFILE) ||
|
||||||
|
currentUsername
|
||||||
) {
|
) {
|
||||||
this._loadProfile(currentAccount.name);
|
this._loadProfile(currentAccount.name);
|
||||||
|
this.setState({ forceLoadPost: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,6 +333,10 @@ class ProfileContainer extends Component {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_changeForceLoadPostState = value => {
|
||||||
|
this.setState({ forceLoadPost: value });
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
avatar,
|
avatar,
|
||||||
@ -349,6 +352,7 @@ class ProfileContainer extends Component {
|
|||||||
selectedQuickProfile,
|
selectedQuickProfile,
|
||||||
user,
|
user,
|
||||||
username,
|
username,
|
||||||
|
forceLoadPost,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
const { isDarkTheme, isLoggedIn, currency, navigation } = this.props;
|
const { isDarkTheme, isLoggedIn, currency, navigation } = this.props;
|
||||||
const activePage = (navigation.state.params && navigation.state.params.activePage) || 0;
|
const activePage = (navigation.state.params && navigation.state.params.activePage) || 0;
|
||||||
@ -379,6 +383,8 @@ class ProfileContainer extends Component {
|
|||||||
selectedQuickProfile={selectedQuickProfile}
|
selectedQuickProfile={selectedQuickProfile}
|
||||||
selectedUser={user}
|
selectedUser={user}
|
||||||
username={username}
|
username={username}
|
||||||
|
forceLoadPost={forceLoadPost}
|
||||||
|
changeForceLoadPostState={this._changeForceLoadPostState}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,8 @@ class ProfileScreen extends PureComponent {
|
|||||||
selectedUser,
|
selectedUser,
|
||||||
username,
|
username,
|
||||||
activePage,
|
activePage,
|
||||||
|
forceLoadPost,
|
||||||
|
changeForceLoadPostState,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -206,6 +208,8 @@ class ProfileScreen extends PureComponent {
|
|||||||
tag={username}
|
tag={username}
|
||||||
key={username}
|
key={username}
|
||||||
handleOnScroll={this._handleOnScroll}
|
handleOnScroll={this._handleOnScroll}
|
||||||
|
forceLoadPost={forceLoadPost}
|
||||||
|
changeForceLoadPostState={changeForceLoadPostState}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View
|
||||||
|
Loading…
Reference in New Issue
Block a user