mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-02 02:07:10 +03:00
Fixed account list issue
This commit is contained in:
parent
caabda2e48
commit
b30d216f38
@ -29,28 +29,27 @@ class SideMenuContainer extends Component {
|
||||
}
|
||||
|
||||
// Component Life Cycle Functions
|
||||
componentWillMount() {
|
||||
const { otherAccounts } = this.props;
|
||||
|
||||
this._createUserList(otherAccounts);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { otherAccounts, isLoggedIn } = this.props;
|
||||
const { isLoggedIn } = this.props;
|
||||
|
||||
if (isLoggedIn && otherAccounts !== nextProps.otherAccounts) {
|
||||
if (isLoggedIn) {
|
||||
this._createUserList(nextProps.otherAccounts);
|
||||
}
|
||||
}
|
||||
|
||||
_createUserList = (otherAccounts) => {
|
||||
const { currentAccount } = this.props;
|
||||
|
||||
const accounts = [];
|
||||
otherAccounts.forEach((element) => {
|
||||
accounts.push({
|
||||
name: `@${element.username}`,
|
||||
username: element.username,
|
||||
id: element.username,
|
||||
});
|
||||
if (element.username !== currentAccount.name) {
|
||||
accounts.push({
|
||||
name: `@${element.username}`,
|
||||
username: element.username,
|
||||
id: element.username,
|
||||
});
|
||||
}
|
||||
});
|
||||
accounts.push({
|
||||
name: 'Add Account',
|
||||
@ -96,7 +95,7 @@ class SideMenuContainer extends Component {
|
||||
render() {
|
||||
const { currentAccount, isLoggedIn } = this.props;
|
||||
const { accounts } = this.state;
|
||||
|
||||
console.log('this.props.otherAccounts :', this.props.otherAccounts);
|
||||
return (
|
||||
<SideMenuView
|
||||
navigateToRoute={this._navigateToRoute}
|
||||
|
Loading…
Reference in New Issue
Block a user