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

Fixed moving cursor to end problem except IOUAmountPage #2010

Merged
merged 2 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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