diff --git a/src/components/Composer/index.js b/src/components/Composer/index.js index af350ae48336..69e3f31031b2 100755 --- a/src/components/Composer/index.js +++ b/src/components/Composer/index.js @@ -10,6 +10,7 @@ import themeColors from '../../styles/themes/default'; import updateIsFullComposerAvailable from '../../libs/ComposerUtils/updateIsFullComposerAvailable'; import * as ComposerUtils from '../../libs/ComposerUtils'; import * as Browser from '../../libs/Browser'; +import * as StyleUtils from '../../styles/StyleUtils'; import withWindowDimensions, {windowDimensionsPropTypes} from '../withWindowDimensions'; import compose from '../../libs/compose'; import styles from '../../styles/styles'; @@ -475,6 +476,7 @@ class Composer extends React.Component { // We are hiding the scrollbar to prevent it from reducing the text input width, // so we can get the correct scroll height while calculating the number of lines. this.state.numberOfLines < this.props.maxLines ? styles.overflowHidden : {}, + StyleUtils.getComposeTextAreaPadding(this.props.numberOfLines), ]} /* eslint-disable-next-line react/jsx-props-no-spreading */ {...propsWithoutStyles} diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 03f86205a809..c68b728adc3c 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -48,6 +48,7 @@ import OfflineWithFeedback from '../../../components/OfflineWithFeedback'; import * as ComposerUtils from '../../../libs/ComposerUtils'; import * as Welcome from '../../../libs/actions/Welcome'; import Permissions from '../../../libs/Permissions'; +import containerComposeStyles from '../../../styles/containerComposeStyles'; import * as Task from '../../../libs/actions/Task'; import * as Browser from '../../../libs/Browser'; import * as IOU from '../../../libs/actions/IOU'; @@ -1111,7 +1112,7 @@ class ReportActionCompose extends React.Component { )} - + - + { diff --git a/src/styles/StyleUtils.js b/src/styles/StyleUtils.js index 77952c412e0c..32c736132ce1 100644 --- a/src/styles/StyleUtils.js +++ b/src/styles/StyleUtils.js @@ -1221,6 +1221,22 @@ function getMentionTextColor(isOurMention) { return isOurMention ? themeColors.ourMentionText : themeColors.mentionText; } +/** + * Returns padding vertical based on number of lines + * @param {Number} numberOfLines + * @returns {Object} + */ +function getComposeTextAreaPadding(numberOfLines) { + let paddingValue = 5; + if (numberOfLines === 1) paddingValue = 9; + // In case numberOfLines = 3, there will be a Expand Icon appearing at the top left, so it has to be recalculated so that the textArea can be full height + if (numberOfLines === 3) paddingValue = 8; + return { + paddingTop: paddingValue, + paddingBottom: paddingValue, + }; +} + /** * Returns style object for the mobile on WEB * @param {Number} windowHeight @@ -1356,6 +1372,7 @@ export { getEmojiPickerListHeight, getMentionStyle, getMentionTextColor, + getComposeTextAreaPadding, getHeightOfMagicCodeInput, getOuterModalStyle, getWrappingStyle, diff --git a/src/styles/containerComposeStyles/index.js b/src/styles/containerComposeStyles/index.js new file mode 100644 index 000000000000..23a4d7ed7720 --- /dev/null +++ b/src/styles/containerComposeStyles/index.js @@ -0,0 +1,6 @@ +import styles from '../styles'; + +// We need to set paddingVertical = 0 on web to avoid displaying a normal pointer on some parts of compose box when not in focus +const containerComposeStyles = [styles.textInputComposeSpacing, {paddingVertical: 0}]; + +export default containerComposeStyles; diff --git a/src/styles/containerComposeStyles/index.native.js b/src/styles/containerComposeStyles/index.native.js new file mode 100644 index 000000000000..002331581108 --- /dev/null +++ b/src/styles/containerComposeStyles/index.native.js @@ -0,0 +1,5 @@ +import styles from '../styles'; + +const containerComposeStyles = [styles.textInputComposeSpacing]; + +export default containerComposeStyles;