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

Add focus indicator for edit composer #12095

Merged
merged 2 commits into from
Oct 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/pages/home/report/ReportActionItemMessageEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class ReportActionItemMessageEdit extends React.Component {
start: draftMessage.length,
end: draftMessage.length,
},
isFocused: false,
};
}

Expand Down Expand Up @@ -198,7 +199,14 @@ class ReportActionItemMessageEdit extends React.Component {
const hasExceededMaxCommentLength = this.state.draft.length > CONST.MAX_COMMENT_LENGTH;
return (
<View style={styles.chatItemMessage}>
<View style={[styles.chatItemComposeBox, styles.flexRow, styles.chatItemComposeBoxColor, hasExceededMaxCommentLength && styles.borderColorDanger]}>
<View
style={[
styles.chatItemComposeBox,
styles.flexRow,
this.state.isFocused ? styles.chatItemComposeBoxFocusedColor : styles.chatItemComposeBoxColor,
hasExceededMaxCommentLength && styles.borderColorDanger,
]}
>
<Composer
multiline
ref={(el) => {
Expand All @@ -211,6 +219,7 @@ class ReportActionItemMessageEdit extends React.Component {
maxLines={16} // This is the same that slack has
style={[styles.textInputCompose, styles.flex4, styles.editInputComposeSpacing]}
onFocus={() => {
this.setState({isFocused: true});
ReportScrollManager.scrollToIndex({animated: true, index: this.props.index}, true);
toggleReportActionComposeView(false, VirtualKeyboard.shouldAssumeIsOpen());
}}
Expand All @@ -219,7 +228,7 @@ class ReportActionItemMessageEdit extends React.Component {
if (_.contains([this.saveButtonID, this.cancelButtonID], lodashGet(event, 'nativeEvent.relatedTarget.id'))) {
return;
}

this.setState({isFocused: false});

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

toggleReportActionComposeView(true, VirtualKeyboard.shouldAssumeIsOpen());
}}
selection={this.state.selection}
Expand Down