[FIX] Pass isFocused as a function to Messagebox (#1309)

This commit is contained in:
Calebe Rios 2019-10-28 17:51:46 -03:00 committed by Diego Mello
parent 20a73907ff
commit c304904380
2 changed files with 4 additions and 4 deletions

View File

@ -65,7 +65,7 @@ class MessageBox extends Component {
replying: PropTypes.bool, replying: PropTypes.bool,
editing: PropTypes.bool, editing: PropTypes.bool,
threadsEnabled: PropTypes.bool, threadsEnabled: PropTypes.bool,
isFocused: PropTypes.bool, isFocused: PropTypes.func,
user: PropTypes.shape({ user: PropTypes.shape({
id: PropTypes.string, id: PropTypes.string,
username: PropTypes.string, username: PropTypes.string,
@ -166,7 +166,7 @@ class MessageBox extends Component {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const { isFocused, editing, replying } = this.props; const { isFocused, editing, replying } = this.props;
if (!isFocused) { if (!isFocused()) {
return; return;
} }
if (editing !== nextProps.editing && nextProps.editing) { if (editing !== nextProps.editing && nextProps.editing) {
@ -189,7 +189,7 @@ class MessageBox extends Component {
const { const {
roomType, replying, editing, isFocused roomType, replying, editing, isFocused
} = this.props; } = this.props;
if (!isFocused) { if (!isFocused()) {
return false; return false;
} }
if (nextProps.roomType !== roomType) { if (nextProps.roomType !== roomType) {

View File

@ -732,7 +732,7 @@ class RoomView extends React.Component {
rid={this.rid} rid={this.rid}
tmid={this.tmid} tmid={this.tmid}
roomType={room.t} roomType={room.t}
isFocused={navigation.isFocused()} isFocused={navigation.isFocused}
message={selectedMessage} message={selectedMessage}
editing={editing} editing={editing}
editRequest={this.onEditRequest} editRequest={this.onEditRequest}