diff --git a/android/app/build.gradle b/android/app/build.gradle index 5bd5feb9db6a6..fe081fdaf89be 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -106,8 +106,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001030001 - versionName "1.3.0-1" + versionCode 1001030002 + versionName "1.3.0-2" } splits { diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index 84aa8cd47d568..14276c6c6433c 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -30,7 +30,7 @@ CFBundleVersion - 1.3.0.1 + 1.3.0.2 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 3e41767a8d702..ee626e3492c1b 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.3.0.1 + 1.3.0.2 diff --git a/package-lock.json b/package-lock.json index 83151ae5beb2f..89b54543f149d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.3.0-1", + "version": "1.3.0-2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.3.0-1", + "version": "1.3.0-2", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index dd89d26fe7fa7..cd102b62b31b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.3.0-1", + "version": "1.3.0-2", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", diff --git a/src/components/EmojiPicker/EmojiPickerButton.js b/src/components/EmojiPicker/EmojiPickerButton.js index 57b391007eae7..58958d1fd360a 100644 --- a/src/components/EmojiPicker/EmojiPickerButton.js +++ b/src/components/EmojiPicker/EmojiPickerButton.js @@ -36,7 +36,7 @@ const EmojiPickerButton = (props) => { StyleUtils.getButtonBackgroundColorStyle(getButtonState(hovered, pressed)), ])} disabled={props.isDisabled} - onPress={() => EmojiPickerAction.showEmojiPicker(props.onModalHide, props.onEmojiSelected, emojiPopoverAnchor, undefined, props.onWillShow)} + onPress={() => EmojiPickerAction.showEmojiPicker(props.onModalHide, props.onEmojiSelected, emojiPopoverAnchor)} nativeID={props.nativeID} > {({hovered, pressed}) => ( diff --git a/src/pages/home/report/ReportActionCompose/index.js b/src/pages/home/report/ReportActionCompose.js similarity index 90% rename from src/pages/home/report/ReportActionCompose/index.js rename to src/pages/home/report/ReportActionCompose.js index 741bf50d10568..5dd7d8c942cb8 100644 --- a/src/pages/home/report/ReportActionCompose/index.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -9,49 +9,49 @@ import { import _ from 'underscore'; import lodashGet from 'lodash/get'; import {withOnyx} from 'react-native-onyx'; -import styles from '../../../../styles/styles'; -import themeColors from '../../../../styles/themes/default'; -import Composer from '../../../../components/Composer'; -import ONYXKEYS from '../../../../ONYXKEYS'; -import Icon from '../../../../components/Icon'; -import * as Expensicons from '../../../../components/Icon/Expensicons'; -import AttachmentPicker from '../../../../components/AttachmentPicker'; -import * as Report from '../../../../libs/actions/Report'; -import ReportTypingIndicator from '../ReportTypingIndicator'; -import AttachmentModal from '../../../../components/AttachmentModal'; -import compose from '../../../../libs/compose'; -import PopoverMenu from '../../../../components/PopoverMenu'; -import withWindowDimensions, {windowDimensionsPropTypes} from '../../../../components/withWindowDimensions'; -import withDrawerState from '../../../../components/withDrawerState'; -import withLocalize, {withLocalizePropTypes} from '../../../../components/withLocalize'; -import willBlurTextInputOnTapOutside from '../../../../libs/willBlurTextInputOnTapOutside'; -import CONST from '../../../../CONST'; -import Navigation from '../../../../libs/Navigation/Navigation'; -import ROUTES from '../../../../ROUTES'; -import reportActionPropTypes from '../reportActionPropTypes'; -import * as ReportUtils from '../../../../libs/ReportUtils'; -import ReportActionComposeFocusManager from '../../../../libs/ReportActionComposeFocusManager'; -import participantPropTypes from '../../../../components/participantPropTypes'; -import ParticipantLocalTime from '../ParticipantLocalTime'; -import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes, withCurrentUserPersonalDetailsDefaultProps} from '../../../../components/withCurrentUserPersonalDetails'; -import {withNetwork, withPersonalDetails} from '../../../../components/OnyxProvider'; -import * as User from '../../../../libs/actions/User'; -import Tooltip from '../../../../components/Tooltip'; -import EmojiPickerButton from '../../../../components/EmojiPicker/EmojiPickerButton'; -import * as DeviceCapabilities from '../../../../libs/DeviceCapabilities'; -import toggleReportActionComposeView from '../../../../libs/toggleReportActionComposeView'; -import OfflineIndicator from '../../../../components/OfflineIndicator'; -import ExceededCommentLength from '../../../../components/ExceededCommentLength'; -import withNavigationFocus from '../../../../components/withNavigationFocus'; -import * as EmojiUtils from '../../../../libs/EmojiUtils'; -import ReportDropUI from '../ReportDropUI'; -import DragAndDrop from '../../../../components/DragAndDrop'; -import reportPropTypes from '../../../reportPropTypes'; -import EmojiSuggestions from '../../../../components/EmojiSuggestions'; -import withKeyboardState, {keyboardStatePropTypes} from '../../../../components/withKeyboardState'; -import ArrowKeyFocusManager from '../../../../components/ArrowKeyFocusManager'; -import KeyboardShortcut from '../../../../libs/KeyboardShortcut'; -import KeyDownAction from './keyDownAction'; +import styles from '../../../styles/styles'; +import themeColors from '../../../styles/themes/default'; +import Composer from '../../../components/Composer'; +import ONYXKEYS from '../../../ONYXKEYS'; +import Icon from '../../../components/Icon'; +import * as Expensicons from '../../../components/Icon/Expensicons'; +import AttachmentPicker from '../../../components/AttachmentPicker'; +import * as Report from '../../../libs/actions/Report'; +import ReportTypingIndicator from './ReportTypingIndicator'; +import AttachmentModal from '../../../components/AttachmentModal'; +import compose from '../../../libs/compose'; +import PopoverMenu from '../../../components/PopoverMenu'; +import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions'; +import withDrawerState from '../../../components/withDrawerState'; +import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; +import willBlurTextInputOnTapOutside from '../../../libs/willBlurTextInputOnTapOutside'; +import CONST from '../../../CONST'; +import Navigation from '../../../libs/Navigation/Navigation'; +import ROUTES from '../../../ROUTES'; +import reportActionPropTypes from './reportActionPropTypes'; +import * as ReportUtils from '../../../libs/ReportUtils'; +import ReportActionComposeFocusManager from '../../../libs/ReportActionComposeFocusManager'; +import participantPropTypes from '../../../components/participantPropTypes'; +import ParticipantLocalTime from './ParticipantLocalTime'; +import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes, withCurrentUserPersonalDetailsDefaultProps} from '../../../components/withCurrentUserPersonalDetails'; +import {withNetwork, withPersonalDetails} from '../../../components/OnyxProvider'; +import * as User from '../../../libs/actions/User'; +import Tooltip from '../../../components/Tooltip'; +import EmojiPickerButton from '../../../components/EmojiPicker/EmojiPickerButton'; +import * as DeviceCapabilities from '../../../libs/DeviceCapabilities'; +import toggleReportActionComposeView from '../../../libs/toggleReportActionComposeView'; +import OfflineIndicator from '../../../components/OfflineIndicator'; +import ExceededCommentLength from '../../../components/ExceededCommentLength'; +import withNavigationFocus from '../../../components/withNavigationFocus'; +import * as EmojiUtils from '../../../libs/EmojiUtils'; +import ReportDropUI from './ReportDropUI'; +import DragAndDrop from '../../../components/DragAndDrop'; +import reportPropTypes from '../../reportPropTypes'; +import EmojiSuggestions from '../../../components/EmojiSuggestions'; +import withKeyboardState, {keyboardStatePropTypes} from '../../../components/withKeyboardState'; +import ArrowKeyFocusManager from '../../../components/ArrowKeyFocusManager'; +import OfflineWithFeedback from '../../../components/OfflineWithFeedback'; +import KeyboardShortcut from '../../../libs/KeyboardShortcut'; const propTypes = { /** Beta features list */ @@ -164,8 +164,6 @@ class ReportActionCompose extends React.Component { this.setIsFullComposerAvailable = this.setIsFullComposerAvailable.bind(this); this.focus = this.focus.bind(this); this.addEmojiToTextBox = this.addEmojiToTextBox.bind(this); - this.replaceSelectionWithInput = this.replaceSelectionWithInput.bind(this); - this.keydownListener = this.keydownListener.bind(this); this.onSelectionChange = this.onSelectionChange.bind(this); this.isEmojiCode = this.isEmojiCode.bind(this); this.setTextInputRef = this.setTextInputRef.bind(this); @@ -204,13 +202,10 @@ class ReportActionCompose extends React.Component { isEmojiPickerLarge: false, composerHeight: 0, hasExceededMaxCommentLength: false, - isEmojiPickerVisible: false, }; } componentDidMount() { - KeyDownAction.listenKeyDown(this.keydownListener); - // This callback is used in the contextMenuActions to manage giving focus back to the compose input. // TODO: we should clean up this convoluted code and instead move focus management to something like ReportFooter.js or another higher up component ReportActionComposeFocusManager.onComposerFocus(() => { @@ -266,9 +261,6 @@ class ReportActionCompose extends React.Component { } componentWillUnmount() { - if (this.keydownListener) { - KeyDownAction.removeListenKeyDown(this.keydownListener); - } ReportActionComposeFocusManager.clear(); if (this.unsubscribeEscapeKey) { @@ -474,45 +466,6 @@ class ReportActionCompose extends React.Component { return _.size(this.props.reportActions) === 1; } - keydownListener(e) { - if (this.state.isFocused || this.state.isEmojiPickerVisible || this.props.modal.isVisible || this.props.isSmallScreenWidth) { - return; - } - - // If the key pressed is non-character keys like Enter, Shift, ... do not focus - if (e.key.length > 1) { - return; - } - - // If a key is pressed in combination with Meta, Control or Alt do not focus - if (e.metaKey || e.ctrlKey || e.altKey) { - return; - } - - // If we're typing on another input/text area, do not focus - if (e.target.nodeName === 'INPUT' || e.target.nodeName === 'TEXTAREA') { - return; - } - - this.focus(); - this.replaceSelectionWithInput(e.key); - } - - /** - * @param {String} text - */ - replaceSelectionWithInput(text) { - const newComment = this.comment.slice(0, this.state.selection.start) - + text - + this.comment.slice(this.state.selection.end, this.comment.length); - this.setState(prevState => ({ - selection: { - start: prevState.selection.start + text.length, - end: prevState.selection.start + text.length, - }, - }), this.updateComment(newComment)); - } - /** * Callback for the emoji picker to add whatever emoji is chosen into the main input * @@ -520,7 +473,16 @@ class ReportActionCompose extends React.Component { */ addEmojiToTextBox(emoji) { const emojiWithSpace = `${emoji} `; - this.replaceSelectionWithInput(emojiWithSpace); + const newComment = this.comment.slice(0, this.state.selection.start) + + emojiWithSpace + + this.comment.slice(this.state.selection.end, this.comment.length); + this.setState(prevState => ({ + selection: { + start: prevState.selection.start + emojiWithSpace.length, + end: prevState.selection.start + emojiWithSpace.length, + }, + })); + this.updateComment(newComment); } /** @@ -911,10 +873,8 @@ class ReportActionCompose extends React.Component { isDisabled={isBlockedFromConcierge || this.props.disabled} onModalHide={() => { this.focus(true); - this.setState({isEmojiPickerVisible: false}); }} onEmojiSelected={this.addEmojiToTextBox} - onWillShow={() => this.setState({isEmojiPickerVisible: true})} /> )}