Skip to content

Fixes #260: Fix cursor position#261

Open
tomegz wants to merge 1 commit into
patw0929:masterfrom
tomegz:improved-6.1.0
Open

Fixes #260: Fix cursor position#261
tomegz wants to merge 1 commit into
patw0929:masterfrom
tomegz:improved-6.1.0

Conversation

@tomegz

@tomegz tomegz commented Jan 8, 2019

Copy link
Copy Markdown
Contributor

No description provided.

@coveralls

Copy link
Copy Markdown

Coverage Status

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

@superhit0

superhit0 commented Jan 8, 2019

Copy link
Copy Markdown
Collaborator

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

tomegz commented Jan 8, 2019

Copy link
Copy Markdown
Contributor Author

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

superhit0 commented Jan 8, 2019

Copy link
Copy Markdown
Collaborator

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

tomegz commented Jan 8, 2019

Copy link
Copy Markdown
Contributor Author

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

superhit0 commented Jan 8, 2019

Copy link
Copy Markdown
Collaborator

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

tomegz commented Jan 8, 2019

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
Collaborator

@superhit0

Copy link
Copy Markdown
Collaborator

putting a do not merge for now

@superhit0

superhit0 commented Jan 9, 2019

Copy link
Copy Markdown
Collaborator

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

#262

@Lucas015

Copy link
Copy Markdown

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