Skip to content

Commit 2200b81

Browse files
authored
Merge pull request #19516 from dukenv0307/fix/regression-18110
Fix/regression 18110 composer should have the same height in other platforms
2 parents c1267ca + 79df68d commit 2200b81

File tree

6 files changed

+34
-2
lines changed

6 files changed

+34
-2
lines changed

src/components/Composer/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import themeColors from '../../styles/themes/default';
1010
import updateIsFullComposerAvailable from '../../libs/ComposerUtils/updateIsFullComposerAvailable';
1111
import * as ComposerUtils from '../../libs/ComposerUtils';
1212
import * as Browser from '../../libs/Browser';
13+
import * as StyleUtils from '../../styles/StyleUtils';
1314
import withWindowDimensions, {windowDimensionsPropTypes} from '../withWindowDimensions';
1415
import compose from '../../libs/compose';
1516
import styles from '../../styles/styles';
@@ -482,6 +483,7 @@ class Composer extends React.Component {
482483
// We are hiding the scrollbar to prevent it from reducing the text input width,
483484
// so we can get the correct scroll height while calculating the number of lines.
484485
this.state.numberOfLines < this.props.maxLines ? styles.overflowHidden : {},
486+
StyleUtils.getComposeTextAreaPadding(this.props.numberOfLines),
485487
]}
486488
/* eslint-disable-next-line react/jsx-props-no-spreading */
487489
{...propsWithoutStyles}

src/pages/home/report/ReportActionCompose.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import OfflineWithFeedback from '../../../components/OfflineWithFeedback';
4949
import * as ComposerUtils from '../../../libs/ComposerUtils';
5050
import * as Welcome from '../../../libs/actions/Welcome';
5151
import Permissions from '../../../libs/Permissions';
52+
import containerComposeStyles from '../../../styles/containerComposeStyles';
5253
import * as Task from '../../../libs/actions/Task';
5354
import * as Browser from '../../../libs/Browser';
5455
import * as IOU from '../../../libs/actions/IOU';
@@ -1110,7 +1111,7 @@ class ReportActionCompose extends React.Component {
11101111
</>
11111112
)}
11121113
</AttachmentPicker>
1113-
<View style={[styles.textInputComposeSpacing, styles.textInputComposeBorder]}>
1114+
<View style={[containerComposeStyles, styles.textInputComposeBorder]}>
11141115
<DragAndDrop
11151116
dropZoneId={this.props.dragAndDropId}
11161117
activeDropZoneId={CONST.REPORT.ACTIVE_DROP_NATIVE_ID + this.props.reportID}

src/pages/home/report/ReportActionItemMessageEdit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import reportActionPropTypes from './reportActionPropTypes';
99
import styles from '../../../styles/styles';
1010
import themeColors from '../../../styles/themes/default';
1111
import * as StyleUtils from '../../../styles/StyleUtils';
12+
import containerComposeStyles from '../../../styles/containerComposeStyles';
1213
import Composer from '../../../components/Composer';
1314
import * as Report from '../../../libs/actions/Report';
1415
import openReportActionComposeViewWhenClosingMessageEdit from '../../../libs/openReportActionComposeViewWhenClosingMessageEdit';
@@ -305,7 +306,7 @@ function ReportActionItemMessageEdit(props) {
305306
hasExceededMaxCommentLength && styles.borderColorDanger,
306307
]}
307308
>
308-
<View style={styles.textInputComposeSpacing}>
309+
<View style={containerComposeStyles}>
309310
<Composer
310311
multiline
311312
ref={(el) => {

src/styles/StyleUtils.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,22 @@ function getMentionTextColor(isOurMention) {
12221222
return isOurMention ? themeColors.ourMentionText : themeColors.mentionText;
12231223
}
12241224

1225+
/**
1226+
* Returns padding vertical based on number of lines
1227+
* @param {Number} numberOfLines
1228+
* @returns {Object}
1229+
*/
1230+
function getComposeTextAreaPadding(numberOfLines) {
1231+
let paddingValue = 5;
1232+
if (numberOfLines === 1) paddingValue = 9;
1233+
// 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
1234+
if (numberOfLines === 3) paddingValue = 8;
1235+
return {
1236+
paddingTop: paddingValue,
1237+
paddingBottom: paddingValue,
1238+
};
1239+
}
1240+
12251241
/**
12261242
* Returns style object for the mobile on WEB
12271243
* @param {Number} windowHeight
@@ -1357,6 +1373,7 @@ export {
13571373
getEmojiPickerListHeight,
13581374
getMentionStyle,
13591375
getMentionTextColor,
1376+
getComposeTextAreaPadding,
13601377
getHeightOfMagicCodeInput,
13611378
getOuterModalStyle,
13621379
getWrappingStyle,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import styles from '../styles';
2+
3+
// We need to set paddingVertical = 0 on web to avoid displaying a normal pointer on some parts of compose box when not in focus
4+
const containerComposeStyles = [styles.textInputComposeSpacing, {paddingVertical: 0}];
5+
6+
export default containerComposeStyles;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import styles from '../styles';
2+
3+
const containerComposeStyles = [styles.textInputComposeSpacing];
4+
5+
export default containerComposeStyles;

0 commit comments

Comments
 (0)