Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions src/components/TextInputFocusable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class TextInputFocusable extends React.Component {
}

componentDidUpdate(prevProps) {
this.focusInput();
Copy link
Contributor Author

@sketchydroide sketchydroide Sep 22, 2020

Choose a reason for hiding this comment

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

I removed this one because whenever the composer is rendered it focus the text input again. I don't think that is the desired behaviour. Specially with the purpose of this PR


if (prevProps.defaultValue !== this.props.defaultValue) {
this.updateNumberOfLines();
}
Expand Down
20 changes: 19 additions & 1 deletion src/page/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class ReportActionCompose extends React.Component {
this.triggerSubmitShortcut = this.triggerSubmitShortcut.bind(this);
this.submitForm = this.submitForm.bind(this);
this.showAttachmentPicker = this.showAttachmentPicker.bind(this);
this.setIsFocused = this.setIsFocused.bind(this);
this.comment = '';
this.state = {isFocused: false};
}

componentDidUpdate(prevProps) {
Expand All @@ -47,6 +49,15 @@ class ReportActionCompose extends React.Component {
}
}

/**
* Updates the Highlight state of the composer
*
* @param {boolean} shouldHighlight
*/
setIsFocused(shouldHighlight) {
this.setState({isFocused: shouldHighlight});
}

/**
* Save our report comment in Ion. We debounce this method in the constructor so that it's not called too often
* to update Ion and re-render this component.
Expand Down Expand Up @@ -138,7 +149,12 @@ class ReportActionCompose extends React.Component {
render() {
return (
<View style={[styles.chatItemCompose]}>
<View style={[styles.chatItemComposeBox, styles.flexRow]}>
<View style={[
this.state.isFocused ? styles.chatItemComposeBoxFocusedColor : styles.chatItemComposeBoxColor,
styles.chatItemComposeBox,
styles.flexRow
]}
>
<TouchableOpacity
onPress={this.showAttachmentPicker}
style={[styles.chatItemAttachButton]}
Expand All @@ -161,6 +177,8 @@ class ReportActionCompose extends React.Component {
style={[styles.textInput, styles.textInputCompose, styles.flex4]}
defaultValue={this.props.comment || ''}
maxLines={16} // This is the same that slack has
onFocus={() => this.setIsFocused(true)}
onBlur={() => this.setIsFocused(false)}
/>
<TouchableOpacity
style={[styles.chatItemSubmitButton, styles.buttonSuccess]}
Expand Down
9 changes: 8 additions & 1 deletion src/style/StyleSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,17 @@ const styles = {
display: 'flex',
},

chatItemComposeBoxColor: {
borderColor: colors.border,
},

chatItemComposeBoxFocusedColor: {
borderColor: colors.blue,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this comment makes it sound like we don't want blue, right @shawnborton?

#114 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, I forgot to update the GH for the expensify one here
it was agreed later that blue was the better option

Copy link
Contributor

Choose a reason for hiding this comment

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

Blue it is!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah missed that one, thanks!

},

chatItemComposeBox: {
backgroundColor: colors.componentBG,
borderWidth: 1,
borderColor: colors.border,
borderRadius: 8,
minHeight: 40,
},
Expand Down