Save scroll state when swapping to non-room pages too

This commit is contained in:
Richard van der Hoff 2015-12-10 21:53:14 +00:00
parent d9782b35e1
commit b7699c0544

View file

@ -254,21 +254,15 @@ module.exports = React.createClass({
});
break;
case 'view_user_settings':
this.setState({
page_type: this.PageTypes.UserSettings,
});
this._setPage(this.PageTypes.UserSettings);
this.notifyNewScreen('settings');
break;
case 'view_create_room':
this.setState({
page_type: this.PageTypes.CreateRoom,
});
this._setPage(this.PageTypes.CreateRoom);
this.notifyNewScreen('new');
break;
case 'view_room_directory':
this.setState({
page_type: this.PageTypes.RoomDirectory,
});
this._setPage(this.PageTypes.RoomDirectory);
this.notifyNewScreen('directory');
break;
case 'notifier_enabled':
@ -297,6 +291,15 @@ module.exports = React.createClass({
}
},
_setPage: function(pageType) {
// record the scroll state if we're in a room view.
this._updateScrollMap();
this.setState({
page_type: this.PageTypes.RoomDirectory,
});
},
_viewRoom: function(roomId) {
// before we switch room, record the scroll state of the current room
this._updateScrollMap();