Skip to content

Commit

Permalink
feat: ReportActionCompose allow autoFocus to be configurable from par…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
kidroca committed Apr 5, 2021
1 parent b2177a6 commit 2f4a7ea
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const propTypes = {
// The ID of the report actions will be created for
reportID: PropTypes.number.isRequired,

// Should the input focus on mount
autoFocus: PropTypes.bool.isRequired,

// Details about any modals being used
modal: PropTypes.shape({
// Indicates if there is a modal currently visible or not
Expand Down Expand Up @@ -62,7 +65,7 @@ class ReportActionCompose extends React.Component {
this.comment = props.comment;

this.state = {
isFocused: true,
isFocused: this.props.autoFocus,
textInputShouldClear: false,
isCommentEmpty: props.comment.length === 0,
isMenuVisible: false,
Expand Down Expand Up @@ -243,7 +246,7 @@ class ReportActionCompose extends React.Component {
)}
</AttachmentPicker>
<TextInputFocusable
autoFocus
autoFocus={this.props.autoFocus}
multiline
ref={el => this.textInput = el}
textAlignVertical="top"
Expand Down

0 comments on commit 2f4a7ea

Please sign in to comment.