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/ copmpser hide on change screen size #18702

Merged
merged 10 commits into from
May 12, 2023
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import * as Composer from '../actions/Composer';
import * as Composer from './actions/Composer';

export default (shouldShowComposeInput) => Composer.setShouldShowComposeInput(shouldShowComposeInput);
Copy link
Member

Choose a reason for hiding this comment

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

We don't need this lib at all. Let's call Composer.setShouldShowComposeInput directly,

Copy link
Contributor Author

@ahmdshrif ahmdshrif May 11, 2023

Choose a reason for hiding this comment

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

@parasharrajat I agree. Please check the last update.

9 changes: 0 additions & 9 deletions src/libs/toggleReportActionComposeView/index.js
ahmdshrif marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

11 changes: 9 additions & 2 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ const propTypes = {
// The date that the user will be unblocked
expiresAt: PropTypes.string,
}),

/** Whether the composer input should be shown */
shouldShowComposeInput: PropTypes.bool,
ahmdshrif marked this conversation as resolved.
Show resolved Hide resolved

/** Stores user's preferred skin tone */
preferredSkinTone: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
Expand Down Expand Up @@ -138,6 +141,7 @@ const defaultProps = {
frequentlyUsedEmojis: [],
isComposerFullSize: false,
pendingAction: null,
shouldShowComposeInput: true,
...withCurrentUserPersonalDetailsDefaultProps,
};

Expand Down Expand Up @@ -188,7 +192,7 @@ class ReportActionCompose extends React.Component {
this.willBlurTextInputOnTapOutside = willBlurTextInputOnTapOutside();

this.state = {
isFocused: this.willBlurTextInputOnTapOutside && !this.props.modal.isVisible && !this.props.modal.willAlertModalBecomeVisible,
isFocused: this.willBlurTextInputOnTapOutside && !this.props.modal.isVisible && !this.props.modal.willAlertModalBecomeVisible && this.props.shouldShowComposeInput,
isFullComposerAvailable: props.isComposerFullSize,
textInputShouldClear: false,
isCommentEmpty: props.comment.length === 0,
Expand Down Expand Up @@ -917,7 +921,7 @@ class ReportActionCompose extends React.Component {
disabled={this.props.disabled}
>
<Composer
autoFocus={!this.props.modal.isVisible && (this.willBlurTextInputOnTapOutside || this.isEmptyChat())}
autoFocus={!this.props.modal.isVisible && (this.willBlurTextInputOnTapOutside || this.isEmptyChat()) && this.props.shouldShowComposeInput}
ahmdshrif marked this conversation as resolved.
Show resolved Hide resolved
multiline
ref={this.setTextInputRef}
textAlignVertical="top"
Expand Down Expand Up @@ -1074,5 +1078,8 @@ export default compose(
preferredSkinTone: {
key: ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE,
},
shouldShowComposeInput: {
key: ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT,
},
}),
)(ReportActionCompose);
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ReportFooter extends React.Component {
)}
</View>
)}
{!hideComposer && this.props.shouldShowComposeInput && (
{(!hideComposer && (this.props.shouldShowComposeInput || !this.props.isSmallScreenWidth)) && (
<View style={[this.getChatFooterStyles(), this.props.isComposerFullSize && styles.chatFooterFullCompose]}>
<SwipeableView onSwipeDown={Keyboard.dismiss}>
<ReportActionCompose
Expand Down