Skip to content

Commit

Permalink
Merge pull request #3434 from aliabbasmalik8/IS-3218-cursor-issue-edi…
Browse files Browse the repository at this point in the history
…t-comment-box

[IS-3218] Fixed cursor issue on edit comment box
  • Loading branch information
Gonals authored Jun 9, 2021
2 parents 072fd90 + d530a94 commit 5ead572
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/pages/home/report/ReportActionItemMessageEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,26 @@ class ReportActionItemMessageEdit extends React.Component {
this.debouncedSaveDraft = _.debounce(this.debouncedSaveDraft.bind(this), 1000, true);
this.publishDraft = this.publishDraft.bind(this);
this.triggerSaveOrCancel = this.triggerSaveOrCancel.bind(this);
this.onSelectionChange = this.onSelectionChange.bind(this);

this.state = {
draft: this.props.draftMessage,
selection: {
start: this.props.draftMessage.length,
end: this.props.draftMessage.length,
},
};
}

/**
* Update Selection on change cursor position.
*
* @param {Event} e
*/
onSelectionChange(e) {
this.setState({selection: e.nativeEvent.selection});
}

/**
* Update the value of the draft in Onyx
*
Expand Down Expand Up @@ -109,6 +123,8 @@ class ReportActionItemMessageEdit extends React.Component {
toggleReportActionComposeView(false);
}}
autoFocus
selection={this.state.selection}
onSelectionChange={this.onSelectionChange}
/>
</View>
<View style={[styles.flexRow, styles.mt1]}>
Expand Down

0 comments on commit 5ead572

Please sign in to comment.