Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix : Unable to type next paragraph in message #7355

Merged
merged 10 commits into from
Jan 24, 2022
18 changes: 17 additions & 1 deletion src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {withNetwork, withPersonalDetails} from '../../../components/OnyxProvider
import DateUtils from '../../../libs/DateUtils';
import Tooltip from '../../../components/Tooltip';
import * as EmojiUtils from '../../../libs/EmojiUtils';
import canUseTouchScreen from '../../../libs/canUseTouchscreen';

const propTypes = {
/** Beta features list */
Expand Down Expand Up @@ -146,6 +147,7 @@ class ReportActionCompose extends React.Component {
this.setTextInputRef = this.setTextInputRef.bind(this);
this.getInputPlaceholder = this.getInputPlaceholder.bind(this);
this.setPreferredSkinTone = this.setPreferredSkinTone.bind(this);
this.isVirtualKeyboardOpen = this.isVirtualKeyboardOpen.bind(this);
ahmdshrif marked this conversation as resolved.
Show resolved Hide resolved

this.state = {
isFocused: this.shouldFocusInputOnScreenFocus,
Expand Down Expand Up @@ -353,13 +355,27 @@ class ReportActionCompose extends React.Component {
}
}

/**
* Allows us to identify whether Virtual keyboard open or not
*
* @returns {boolean}
ahmdshrif marked this conversation as resolved.
Show resolved Hide resolved
ahmdshrif marked this conversation as resolved.
Show resolved Hide resolved
*/
isVirtualKeyboardOpen() {
ahmdshrif marked this conversation as resolved.
Show resolved Hide resolved
// check if platform is web and supports virtualkeyboard
ahmdshrif marked this conversation as resolved.
Show resolved Hide resolved
if (navigator && 'virtualkeyboard' in navigator) {
ahmdshrif marked this conversation as resolved.
Show resolved Hide resolved
const keyboardPosition = navigator.virtualKeyboard.boundingRect.y;
return keyboardPosition > 0;
ahmdshrif marked this conversation as resolved.
Show resolved Hide resolved
}
return canUseTouchScreen();
}

/**
* Listens for keyboard shortcuts and applies the action
*
* @param {Object} e
*/
triggerHotkeyActions(e) {
if (!e) {
if (!e || this.isVirtualKeyboardOpen()) {
return;
}

Expand Down