Skip to content
Open
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
7 changes: 7 additions & 0 deletions src/components/IntlTelInputApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class IntlTelInputApp extends Component {
componentDidUpdate(prevProps) {
if (this.props.value !== prevProps.value) {
this.updateFlagFromNumber(this.props.value);
this.updateCursorPosition((this.props.value || this.props.defaultValue).length);
}

if (
Expand Down Expand Up @@ -677,6 +678,12 @@ class IntlTelInputApp extends Component {
return number;
};

updateCursorPosition = (cursorPosition) => {
this.setState({
cursorPosition,
});
}

// update the input's value to the given val (format first if possible)
// if doNotify is true, calls notifyPhoneNumberChange with the formatted value
// NOTE: this is called from _setInitialState, handleUtils and setNumber
Expand Down