I'm using formatted number from onPhoneNumberChange to be value of the input. The cursor position is fine when formatted number is exactly the same as input, but when the formatted number is different than the value, then cursor is misplaced.
Live minimal example here: https://tomegz.github.io/react-intl-tel-input-cursor-example/
Code:
class App extends Component {
constructor(props) {
super(props)
this.state = {
value: '',
infoVisible: false,
}
this.onPhoneNumberChange = this.onPhoneNumberChange.bind(this)
}
onPhoneNumberChange(isValid, value, countryData, number) {
this.setState({
value: number,
infoVisible: value !== number
})
}
render() {
const { value, infoVisible } = this.state
return (
<div className="container">
<p>Type here:</p>
<IntlTelInput
css={['intl-tel-input', 'form-control']}
value={value}
onPhoneNumberChange={this.onPhoneNumberChange}
/>
{infoVisible && <p style={{ position: 'absolute', color: 'red', top: '30px' }}>Cursor position just broke!</p>}
</div>
);
}
}
I submitted #261 to fix this issue
I'm using formatted number from onPhoneNumberChange to be value of the input. The cursor position is fine when formatted number is exactly the same as input, but when the formatted number is different than the value, then cursor is misplaced.
Live minimal example here: https://tomegz.github.io/react-intl-tel-input-cursor-example/
Code:
I submitted #261 to fix this issue