Make ChangeAvatar support room avatars and tweak RoomAvatar respond to componentWillReceiveProps

This commit is contained in:
David Baker 2015-10-23 17:34:11 +01:00
parent 03dfd57a79
commit 5a760b71d0
3 changed files with 31 additions and 5 deletions

View file

@ -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;