Skip to content

Commit

Permalink
Fixed moving cursor to end problem except IOUAmountPage
Browse files Browse the repository at this point in the history
  • Loading branch information
tugbadogan committed Mar 23, 2021
1 parent c86cc4d commit 7bb32d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/TextInputFocusable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const propTypes = {

// Whether or not this TextInput is disabled.
isDisabled: PropTypes.bool,

// Whether or not force move cursor to end all the time
forceMoveCursorToEnd: PropTypes.bool,
};

const defaultProps = {
Expand All @@ -49,6 +52,7 @@ const defaultProps = {
onDragLeave: () => {},
onDrop: () => {},
isDisabled: false,
forceMoveCursorToEnd: false,
};

const IMAGE_EXTENSIONS = {
Expand Down Expand Up @@ -110,7 +114,9 @@ class TextInputFocusable extends React.Component {
}
if (prevProps.defaultValue !== this.props.defaultValue) {
this.updateNumberOfLines();
this.moveCursorToEnd();
if (this.props.forceMoveCursorToEnd) {
this.moveCursorToEnd();
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/pages/iou/steps/IOUAmountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class IOUAmountPage extends React.Component {
ref={el => this.textInput = el}
defaultValue={this.props.amount}
textAlign="left"
forceMoveCursorToEnd
/>
<Text
style={[styles.iouAmountText, styles.invisible, {left: 100000}]}
Expand Down

0 comments on commit 7bb32d8

Please sign in to comment.