From 2658cd09b59bdafb59f110a4ee31633cacb32a0c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 20 Dec 2016 12:33:07 +0000 Subject: [PATCH] Fix scroll jumping when a video is decrypted Call the `onWidgetLoad` prop on MVideoBody to notify the scroll panel to keep it's position when the size of the video widget updates. --- src/components/views/messages/MVideoBody.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/views/messages/MVideoBody.js b/src/components/views/messages/MVideoBody.js index 7279f5c325..18552a973d 100644 --- a/src/components/views/messages/MVideoBody.js +++ b/src/components/views/messages/MVideoBody.js @@ -27,6 +27,14 @@ import q from 'q'; module.exports = React.createClass({ displayName: 'MVideoBody', + propTypes: { + /* the MatrixEvent to show */ + mxEvent: React.PropTypes.object.isRequired, + + /* called when the video has loaded */ + onWidgetLoad: React.PropTypes.func.isRequired, + }, + getInitialState: function() { return { decryptedUrl: null, @@ -100,6 +108,7 @@ module.exports = React.createClass({ decryptedThumbnailUrl: thumbnailUrl, decryptedBlob: decryptedBlob, }); + this.props.onWidgetLoad(); }); }).catch((err) => { console.warn("Unable to decrypt attachment: ", err)