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/regression 18110 composer should have the same height in other platforms #19516

Merged
merged 15 commits into from
Jul 24, 2023
5 changes: 5 additions & 0 deletions src/components/Composer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ class Composer extends React.Component {
}

render() {
let paddingValue = 5;
if (this.props.numberOfLines === 1) paddingValue = 9;
Copy link
Collaborator

@mananjadhav mananjadhav May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be moved to styles? I think it doesn't make sense to have styling added as code in render. Better to get it from styles.

Copy link
Contributor Author

@dukenv0307 dukenv0307 May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved it to StyleUtils. @mananjadhav please check again

// 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 (this.props.numberOfLines === 3) paddingValue = 8;
const propStyles = StyleSheet.flatten(this.props.style);
propStyles.outline = 'none';
const propsWithoutStyles = _.omit(this.props, 'style');
Expand Down Expand Up @@ -471,6 +475,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 : {},
{paddingTop: paddingValue, paddingBottom: paddingValue},
]}
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...propsWithoutStyles}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import * as ComposerActions from '../../../libs/actions/Composer';
import * as Welcome from '../../../libs/actions/Welcome';
import Permissions from '../../../libs/Permissions';
import * as TaskUtils from '../../../libs/actions/Task';
import getContainerComposeStyle from '../../../styles/getContainerComposeStyles';
import * as Browser from '../../../libs/Browser';

const propTypes = {
Expand Down Expand Up @@ -1041,7 +1042,7 @@ class ReportActionCompose extends React.Component {
</>
)}
</AttachmentPicker>
<View style={[styles.textInputComposeSpacing, styles.textInputComposeBorder]}>
<View style={getContainerComposeStyle()}>
<DragAndDrop
dropZoneId={CONST.REPORT.DROP_NATIVE_ID}
activeDropZoneId={CONST.REPORT.ACTIVE_DROP_NATIVE_ID}
Expand Down
3 changes: 3 additions & 0 deletions src/styles/getContainerComposeStyles/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import styles from '../styles';
// we need to set paddingVertical = 0 on the web to avoid App displays normal pointer on some parts of compose box when not in focus
dukenv0307 marked this conversation as resolved.
Show resolved Hide resolved
export default () => [styles.textInputComposeSpacing, styles.textInputComposeBorder, {paddingVertical: 0}];
3 changes: 3 additions & 0 deletions src/styles/getContainerComposeStyles/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import styles from '../styles';

export default () => [styles.textInputComposeSpacing, styles.textInputComposeBorder];