Skip to content

Commit b11bddc

Browse files
authored
Merge pull request #26926 from jscardona12/hotfix/26222
26222: Fix padding jump when isComposerFullSize
2 parents 5c13816 + e703657 commit b11bddc

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/components/Composer/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ const propTypes = {
8383
/** Whether this is the report action compose */
8484
isReportActionCompose: PropTypes.bool,
8585

86+
/** Whether the sull composer is open */
87+
isComposerFullSize: PropTypes.bool,
88+
8689
...withLocalizePropTypes,
8790

8891
...windowDimensionsPropTypes,
@@ -111,6 +114,7 @@ const defaultProps = {
111114
shouldCalculateCaretPosition: false,
112115
checkComposerVisibility: () => false,
113116
isReportActionCompose: false,
117+
isComposerFullSize: false,
114118
};
115119

116120
/**
@@ -161,6 +165,7 @@ function Composer({
161165
checkComposerVisibility,
162166
selection: selectionProp,
163167
isReportActionCompose,
168+
isComposerFullSize,
164169
...props
165170
}) {
166171
const textRef = useRef(null);
@@ -440,9 +445,9 @@ function Composer({
440445
numberOfLines < maxLines ? styles.overflowHidden : {},
441446

442447
StyleSheet.flatten([style, {outline: 'none'}]),
443-
StyleUtils.getComposeTextAreaPadding(numberOfLinesProp),
448+
StyleUtils.getComposeTextAreaPadding(numberOfLinesProp, isComposerFullSize),
444449
],
445-
[style, maxLines, numberOfLinesProp, numberOfLines],
450+
[style, maxLines, numberOfLinesProp, numberOfLines, isComposerFullSize],
446451
);
447452

448453
return (

src/styles/StyleUtils.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,11 +1098,18 @@ function getMentionTextColor(isOurMention: boolean): string {
10981098
/**
10991099
* Returns padding vertical based on number of lines
11001100
*/
1101-
function getComposeTextAreaPadding(numberOfLines: number): ViewStyle | CSSProperties {
1101+
function getComposeTextAreaPadding(numberOfLines: number, isComposerFullSize: boolean): ViewStyle | CSSProperties {
11021102
let paddingValue = 5;
1103-
if (numberOfLines === 1) paddingValue = 9;
1104-
// 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
1105-
if (numberOfLines === 3) paddingValue = 8;
1103+
// Issue #26222: If isComposerFullSize paddingValue will always be 5 to prevent padding jumps when adding multiple lines.
1104+
if (!isComposerFullSize) {
1105+
if (numberOfLines === 1) {
1106+
paddingValue = 9;
1107+
}
1108+
// 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
1109+
else if (numberOfLines === 3) {
1110+
paddingValue = 8;
1111+
}
1112+
}
11061113
return {
11071114
paddingTop: paddingValue,
11081115
paddingBottom: paddingValue,

0 commit comments

Comments
 (0)