Comments (13)
I'm having this exact problem with version 1.0.1 on a Nexus 5X and our QA's Samsung S6. I updated to 1.0.2 and it seems to have fixed it on my Nexus 5X, but version 1.2.0 does not work.
from react-number-format.
I've investigated this a bit, and it seems like let cursorPos = el.selectionStart;
in the onChangeHandler
returns the wrong thing. So after I write for example 4 in the input, cursorPos
is still set to 0
.
This works however on 1.0.2, where refs where being used.
It happens on my device Google Pixel 7.1.2
Thoughts @s-yadav ?
from react-number-format.
@pudgereyem Hey could not reproduce this on browserstack can you try the alpha version again ?
from react-number-format.
Hi @s-yadaw, I just tried on the Codepen demo and still same error. I can have a look at the changes today.
I get that it's frustrating to not be able to test the version I've reported as not working. Would be nice if we could find a solution. I'll have a look soon.
from react-number-format.
Browserstack does have real device testing but can't reproduce it there either.
Have you installed some custom keyboard on your device?
Also try the codepen again by clearing cache just to make sure old code not been cached.
from react-number-format.
Yes, it works in Browserstack for me too. But not on my actual phone. I wonder if it's the same version (7.1.2). Browserstack only say (7.1). I've also cleared the cache, didn't help.
Recording
I pulled down the project, using 2.0.0-alpha2
, and recorded both my phone, and the Chrome Console (Remote testing).
I also added two lines of code that's logging
cursorPosition
inonChangeHandler
. See screenshot; http://pudge.se/gEraYU
- Google Pixel 7.1.2: http://pudge.se/bWrX6s
- Remote Device Inspect: http://pudge.se/ci6rR
Takeaways
- On first input, the
cursorPos
is wrong. It returns0
when it should be1
- On first input, the character inputed gets underlined, see screenshot; http://pudge.se/81EVaA
- On first input, the keyboard layout is changed, why? see screenshot; http://pudge.se/81EVaA
from react-number-format.
Based on the takeaways in my comment above, I did some testing.
When changing the type
to tel
it works. I'm not sure why, I'll investigate this more.
ping @s-yadav
from react-number-format.
I guess it has do with your soft keyboard you are using.
Are you using any other keyboard app than native one ?
from react-number-format.
@s-yadav I use the native keyboard. What do you mean with "soft keyboard"?
from react-number-format.
The mobile keyboard. Can you try logging el.selectionStart and el.selectionEnd on onChange handler.
from react-number-format.
@pudgereyem Can you try alpha3 build once? I hope that's the possible fix for pixel.
from react-number-format.
Fixed in 2.0.0 alpha
from react-number-format.
Hi @s-yadav, this issue went away if you used type="tel"
.
from react-number-format.
Related Issues (20)
- 5.3.1 Regression: Typing "." leads to "^0.00" where "^" is location of caret HOT 1
- NumericFormat: customInput Antd Input is not working properly HOT 9
- Rounding with decimalScale={1} HOT 1
- IPv4 Address Mask HOT 1
- NumericFormat suffix is not allowing antdesign input to handle suffix HOT 1
- Support IME japanese keyboard HOT 2
- Not able to delete negative sign using backspace button HOT 1
- Intl.NumberFormat with fraction digits. input box <=> form state mismatch HOT 2
- percentage formatting, input box <=> form state mismatch
- Controlled Input will convert -0 to 0 HOT 2
- Problem with default value doesnt override mask, but add this value to end mask HOT 1
- Package should not throw errors when `thousandSeparator` and `decimalSeparator` are similar
- Caret moved at the end when used with Ant Design library HOT 2
- The caret position isn't set properly when I use the `removeFormatting` function to use the Persian numbers with the `thousandSeparator` prop HOT 3
- Removing last number with trailing zeros deletes all the right side zeros, when integrating with `react-hook-form` HOT 5
- TypeError: Cannot read property 'length' of undefined, js engine: hermes
- Decimal rounding up HOT 3
- Caret focus in empty place with format value HOT 3
- Type error preventing app from deploying 'No inputs were found in config file '.../node_modules/react-number-format/tsconfig.json'. HOT 2
- Why NumericFormat is not working with react-hook-form refs? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-number-format.