-
Notifications
You must be signed in to change notification settings - Fork 197
Cursor doesn't keep up with typing on some Samsung Android phones #75
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Did you install the latest version by the way. |
You can check that in the browser: if you open DevTools and select the |
I have same issue with latest version and Samsung device. |
@Gedzis is |
The pull request relies on Use case: Select
So, from the use case it seems like the same issue as this one: When a timeout is introduced the |
@catamphetamine I agree that setting timeout isn't best solution. |
Hi @catamphetamine , yes it's reproducible on the latest version. It happens with and without I'm just trying to identify exactly when it goes wrong in the onChange -> render cycle. |
If you want my directions then provided this simulation it's the caret positioning code:
i.e. the caret always moves 1 step forward and is uncontrollable through |
Hi @catamphetamine, I've realised it's more complex. I get:
I've stepped through the code, and |
Also, the cursor is updated correctly by setCaretPosition(), but it reverts to the incorrect place. |
My feeling is like on Androids the keyboard is stubborn and forces itself through any programmatic cursor positioning. |
And if it was React resetting the caret position then AFAIK it always resets to the end, which is not the case in your case. |
Calling |
So, your point is that the cursor position only resets in the React case and that in a simple event hook |
@catamphetamine , that's right. I'm trying to breakpoint in places where react might update the carot position with no luck. |
Yeah, that's a tricky one. |
Is there any update on this bug. I am facing same problem on ios as well |
@shivgarg5676 This bug is for Android only. |
Yes, this is on android only and that too some limited devices. But are we able to address this |
@shivgarg5676 My guess is that this bug is unbeatable. |
Is there any way we can disable this spacing and formatting feature. This will automatically disable this bug. |
@shivgarg5676 Use |
We're seeing it too. It happens on Samsung 7.0 devices but does not happen on:
|
@jcollum I know on iPhones there's a debugging feature: one can hook up an iPhone to a macOS machine and then observe any |
Yes, pretty sure you can do that with Chrome debugging tools: |
For anyone interested, copy-pasting from the PR: #74 (comment)
|
Hi @catamphetamine , yes you can debug on physical mobile phone on android. You can use chrome, firefox, even with safari. After you give at your phone developer permissions and you can set up debugging with usb, you can use that features. Firefox --> Firefox WebIDE Even if you can use adb or android studio for that purpose and into console view get different logs. Only I leave this message because I saw your before answer. I didn't try yet this component, but I was reading different threads about this issues. I don't have to much time time but if possible I'd try to see this issue for myself. But for my experience a delay something, it's not usually good solution. Because of ent lop work in javascript https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop If you need to do something after setstate is called, or you use callback param or lifecycle into react components like https://reactjs.org/docs/react-component.html#componentdidupdate to do something with DOM. Thanks ;) |
Maybe if there's an elegant way to remove Create like an "autoFormat" prop, and if false, then that flag is carried into input-control.js and it only passes the parsed input into the formatter if autoFormat flag is true (default) |
No, it is not.
I guess this can be implemented without any difficulties. |
So, I implemented the feature.
Usage: import Phone from 'react-phone-number-input'
<Phone
smartCaret={false}
value={this.state.value}
onChange={value => this.setState(value)}/>
Internally The demo has also been updated with an example of using the |
Great fix @catamphetamine, I have been testing today from my device Samsung Galaxy S7 edge, everything is working fine. I tried to reproduce different issues commented above, and they work well, also I've tried other possibilities and it works fine. |
I also rewrote |
Hey @catamphetamine, I did test right now with new version and still working fine in my samsung phone. I've tested to different browsers from Samsung Galaxy S7 Edge: Chrome ✅ Even I have simulated with Xcode iPhone X (Safari Browser ✅) is working fine. But for main mobile browser (Chrome and Safari) is working fine. The problem only persist with that Samsung browser but this one is a minor issue, I haven't tried other browsers. You have more here. Also I leave a codePen. I did quickly test in there. Everyone can check it for their self. |
@Xopsy wow, thanks for thorough testing 👍 Samsung seems to be a really big company that can afford writing its own everything: their own Android shell, their own Bixby, their own web browser... Looks like another Microsoft to me. I added a The demo has also been updated with an example of using the |
Update: I released version |
Since |
FYI: released version |
@catamphetamine I was getting same bug, it worked after setting smartCart = {false} |
This reproducible on my Huawei running Android 6.0, and on Samsung S8+ phones. It happens with and without
type="tel"
in the<Phone>
declaration, so I don't think it's related to this issue.Set the country to "UK", and type in "077915". The input will contain "07791 5" (with a space) and the cursor will be positioned before the 5. Typing "67890" after this results in "07791 678905" instead of "07791 567890".
It appears that on these devices that doing a complete onChange -> setState -> render cycle results in the cursor being positioned incorrectly. Calling setState in a setTimeout callback seems to fix it.
Here's a pull request that seems to resolve the issue on my device: #74
The text was updated successfully, but these errors were encountered: