mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-02 11:15:35 +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
|
// Component Life Cycle Functions
|
||||||
componentWillMount() {
|
|
||||||
const { otherAccounts } = this.props;
|
|
||||||
|
|
||||||
this._createUserList(otherAccounts);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
const { otherAccounts, isLoggedIn } = this.props;
|
const { isLoggedIn } = this.props;
|
||||||
|
|
||||||
if (isLoggedIn && otherAccounts !== nextProps.otherAccounts) {
|
if (isLoggedIn) {
|
||||||
this._createUserList(nextProps.otherAccounts);
|
this._createUserList(nextProps.otherAccounts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_createUserList = (otherAccounts) => {
|
_createUserList = (otherAccounts) => {
|
||||||
|
const { currentAccount } = this.props;
|
||||||
|
|
||||||
const accounts = [];
|
const accounts = [];
|
||||||
otherAccounts.forEach((element) => {
|
otherAccounts.forEach((element) => {
|
||||||
accounts.push({
|
if (element.username !== currentAccount.name) {
|
||||||
name: `@${element.username}`,
|
accounts.push({
|
||||||
username: element.username,
|
name: `@${element.username}`,
|
||||||
id: element.username,
|
username: element.username,
|
||||||
});
|
id: element.username,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
accounts.push({
|
accounts.push({
|
||||||
name: 'Add Account',
|
name: 'Add Account',
|
||||||
@ -96,7 +95,7 @@ class SideMenuContainer extends Component {
|
|||||||
render() {
|
render() {
|
||||||
const { currentAccount, isLoggedIn } = this.props;
|
const { currentAccount, isLoggedIn } = this.props;
|
||||||
const { accounts } = this.state;
|
const { accounts } = this.state;
|
||||||
|
console.log('this.props.otherAccounts :', this.props.otherAccounts);
|
||||||
return (
|
return (
|
||||||
<SideMenuView
|
<SideMenuView
|
||||||
navigateToRoute={this._navigateToRoute}
|
navigateToRoute={this._navigateToRoute}
|
||||||
|
Loading…
Reference in New Issue
Block a user