fix(LargeVideo): Fix large video not resizing when closing chat.

This commit is contained in:
Mihai-Andrei Uscat 2021-02-24 14:26:00 +02:00 committed by GitHub
parent 79bb98dab3
commit a7db7ecaff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 22 deletions

View File

@ -20,9 +20,10 @@ export * from './actions.any';
*/ */
export function openChat(participant: Object) { export function openChat(participant: Object) {
return function(dispatch: (Object) => Object) { return function(dispatch: (Object) => Object) {
dispatch({ participant, dispatch({
type: OPEN_CHAT }); participant,
VideoLayout.onResize(); type: OPEN_CHAT
});
}; };
} }
@ -40,5 +41,8 @@ export function toggleChat() {
} else { } else {
dispatch(openChat()); dispatch(openChat());
} }
// Recompute the large video size whenever we toggle the chat, as it takes chat state into account.
VideoLayout.onResize();
}; };
} }

View File

@ -4,7 +4,6 @@ import React from 'react';
import { translate } from '../../../base/i18n'; import { translate } from '../../../base/i18n';
import { connect } from '../../../base/redux'; import { connect } from '../../../base/redux';
import { toggleChat } from '../../actions.web';
import AbstractChat, { import AbstractChat, {
_mapStateToProps, _mapStateToProps,
type Props type Props
@ -52,7 +51,6 @@ class Chat extends AbstractChat<Props> {
// Bind event handlers so they are only bound once for every instance. // Bind event handlers so they are only bound once for every instance.
this._renderPanelContent = this._renderPanelContent.bind(this); this._renderPanelContent = this._renderPanelContent.bind(this);
this._onChatInputResize = this._onChatInputResize.bind(this); this._onChatInputResize = this._onChatInputResize.bind(this);
this._onToggleChat = this._onToggleChat.bind(this);
} }
/** /**
@ -137,9 +135,7 @@ class Chat extends AbstractChat<Props> {
*/ */
_renderChatHeader() { _renderChatHeader() {
return ( return (
<Header <Header className = 'chat-header' />
className = 'chat-header'
onCancel = { this._onToggleChat } />
); );
} }
@ -203,18 +199,6 @@ class Chat extends AbstractChat<Props> {
} }
_onSendMessage: (string) => void; _onSendMessage: (string) => void;
_onToggleChat: () => void;
/**
* Toggles the chat window.
*
* @returns {Function}
*/
_onToggleChat() {
this.props.dispatch(toggleChat());
}
} }
export default translate(connect(_mapStateToProps)(Chat)); export default translate(connect(_mapStateToProps)(Chat));

View File

@ -5,7 +5,7 @@ import React from 'react';
import { translate } from '../../../base/i18n'; import { translate } from '../../../base/i18n';
import { Icon, IconClose } from '../../../base/icons'; import { Icon, IconClose } from '../../../base/icons';
import { connect } from '../../../base/redux'; import { connect } from '../../../base/redux';
import { closeChat } from '../../actions.any'; import { toggleChat } from '../../actions.web';
type Props = { type Props = {
@ -42,6 +42,6 @@ function Header({ onCancel, className, t }: Props) {
); );
} }
const mapDispatchToProps = { onCancel: closeChat }; const mapDispatchToProps = { onCancel: toggleChat };
export default translate(connect(null, mapDispatchToProps)(Header)); export default translate(connect(null, mapDispatchToProps)(Header));