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

Fixes #260: Fix cursor position #261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tomegz
Copy link
Contributor

@tomegz tomegz commented Jan 8, 2019

No description provided.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 94.048% when pulling df9c35d on tomegz:improved-6.1.0 into 6c8ce61 on patw0929:master.

@superhit0
Copy link
Collaborator

superhit0 commented Jan 8, 2019

Can you close this?

I fixed this issue some time back, will have a look & fix it

But I dont see this happening in our live demo app

@tomegz
Copy link
Contributor Author

tomegz commented Jan 8, 2019

Look at the code from my example #260 . I'm using number instead of value.
If you want to reproduce it on master just change :

this.setState({
  [name]: value,
})

to:

this.setState({
  [name]: number,
})

in example.js. Then run npm start and see that example brakes.

@superhit0
Copy link
Collaborator

superhit0 commented Jan 8, 2019

can you tell why are you using number?

Why can't you use value?

like in example

I am just trying to understand the use case. like why would you format a number which has not been completely entered

@tomegz
Copy link
Contributor Author

tomegz commented Jan 8, 2019

My use case is, that I want to show the user the formatted number including the country code. I think the cursor shouldn't brake regardless of what I want to in the input.

@superhit0
Copy link
Collaborator

superhit0 commented Jan 8, 2019

ok got your use case.

But I think we need to improve our logic here.

Just try this with your change

  • Completely enter the formatted number
  • After that move the cursor to middle, then delete 1 number by clicking backspace
  • the cursor will jump to end

@tomegz would you like to help us on this?

This might help https://github.com/patw0929/react-intl-tel-input/blob/master/src/components/IntlTelInputApp.js#L1180

@tomegz
Copy link
Contributor Author

tomegz commented Jan 8, 2019

@superhit0 You're right, I didn't take it into account.
Yes, I'll see what I can do when I have some time
👍

@superhit0
Copy link
Collaborator

@superhit0
Copy link
Collaborator

putting a do not merge for now

@superhit0
Copy link
Collaborator

superhit0 commented Jan 9, 2019

@tomegz I have raised another PR, can you can test your use cases on those changes?

#262

@Lucas015
Copy link

I still have an issue with the curser when I enter any number starting with +2784... the curser will then move to the front of the cell phone number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants