Merge commit '99d2392
' into rav/roomview_works
Conflicts: src/components/structures/RoomView.js
This commit is contained in:
commit
ac4b36c0dd
7 changed files with 57 additions and 10 deletions
|
@ -225,7 +225,8 @@ module.exports = React.createClass({
|
|||
ref={this._collectEventNode.bind(this, eventId)}
|
||||
data-scroll-token={scrollToken}>
|
||||
<EventTile mxEvent={mxEv} continuation={continuation}
|
||||
last={last} isSelectedEvent={highlight}/>
|
||||
last={last} isSelectedEvent={highlight}
|
||||
onImageLoad={this._onImageLoad} />
|
||||
</li>
|
||||
);
|
||||
|
||||
|
@ -278,6 +279,16 @@ module.exports = React.createClass({
|
|||
this.eventNodes[eventId] = node;
|
||||
},
|
||||
|
||||
|
||||
// once images in the events load, make the scrollPanel check the
|
||||
// scroll offsets.
|
||||
_onImageLoad: function() {
|
||||
var scrollPanel = this.refs.messagePanel;
|
||||
if (scrollPanel) {
|
||||
scrollPanel.checkScroll();
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var ScrollPanel = sdk.getComponent("structures.ScrollPanel");
|
||||
return (
|
||||
|
|
|
@ -722,6 +722,15 @@ module.exports = React.createClass({
|
|||
}
|
||||
}
|
||||
|
||||
// once images in the search results load, make the scrollPanel check
|
||||
// the scroll offsets.
|
||||
var onImageLoad = () => {
|
||||
var scrollPanel = this.refs.searchResultsPanel;
|
||||
if (scrollPanel) {
|
||||
scrollPanel.checkScroll();
|
||||
}
|
||||
}
|
||||
|
||||
var lastRoomId;
|
||||
|
||||
for (var i = this.state.searchResults.results.length - 1; i >= 0; i--) {
|
||||
|
@ -758,7 +767,8 @@ module.exports = React.createClass({
|
|||
ret.push(<SearchResultTile key={mxEv.getId()}
|
||||
searchResult={result}
|
||||
searchHighlights={this.state.searchHighlights}
|
||||
resultLink={resultLink}/>);
|
||||
resultLink={resultLink}
|
||||
onImageLoad={onImageLoad}/>);
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
|
|
|
@ -124,10 +124,9 @@ module.exports = React.createClass({
|
|||
// after adding event tiles, we may need to tweak the scroll (either to
|
||||
// keep at the bottom of the timeline, or to maintain the view after
|
||||
// adding events to the top).
|
||||
this._restoreSavedScrollState();
|
||||
|
||||
// we also re-check the fill state, in case the paginate was inadequate
|
||||
this.checkFillState();
|
||||
//
|
||||
// This will also re-check the fill state, in case the paginate was inadequate
|
||||
this.checkScroll();
|
||||
},
|
||||
|
||||
componentWillUnmount: function() {
|
||||
|
@ -178,6 +177,13 @@ module.exports = React.createClass({
|
|||
this.checkFillState();
|
||||
},
|
||||
|
||||
// after an update to the contents of the panel, check that the scroll is
|
||||
// where it ought to be, and set off pagination requests if necessary.
|
||||
checkScroll: function() {
|
||||
this._restoreSavedScrollState();
|
||||
this.checkFillState();
|
||||
},
|
||||
|
||||
// return true if the content is fully scrolled down right now; else false.
|
||||
//
|
||||
// note that this is independent of the 'stuckAtBottom' state - it is simply
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue