Make ChangeAvatar support room avatars and tweak RoomAvatar respond to componentWillReceiveProps
This commit is contained in:
parent
03dfd57a79
commit
5a760b71d0
3 changed files with 31 additions and 5 deletions
|
@ -34,13 +34,24 @@ module.exports = {
|
|||
},
|
||||
|
||||
getInitialState: function() {
|
||||
this.urlList = this.getUrlList();
|
||||
this.urlListIndex = -1;
|
||||
this._update();
|
||||
return {
|
||||
imageUrl: this._nextUrl()
|
||||
};
|
||||
},
|
||||
|
||||
componentWillReceiveProps: function(nextProps) {
|
||||
this._update();
|
||||
this.setState({
|
||||
imageUrl: this._nextUrl()
|
||||
});
|
||||
},
|
||||
|
||||
_update: function() {
|
||||
this.urlList = this.getUrlList();
|
||||
this.urlListIndex = -1;
|
||||
},
|
||||
|
||||
_nextUrl: function() {
|
||||
do {
|
||||
++this.urlListIndex;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue