Comments (6)
@LinusGeffarth, sure, but that's a completely arbitrary solution since there's no documentation on how exactly these text suggestions work programmatic-wise. This is a reverse engineering conclusion.
There are no guarantees next time they won't use an empty string instead of a single space, there are no guarantees they won't introduce a single-step process in iOS 13 or even a real callback or something.
You see, there's a similar problem #32. And the only somewhat reliable solution (#33) affects the main dispatch queue, hence affects the main run loop. Hence, affects all the view controller transitions, for instance. And many other things relying on the main queue consecutive consistency.
All because in iOS 11 they've decided to asynchronously recalculate cursor positioning for some reason. A completely legitimate step since there's no documentation on how the text is pasted from the clipboard programmatic-wise.
from input-mask-ios.
Hey @patthehuman!
Thanks for your question.
Could you please be more specific about the scenario you are having trouble with?
from input-mask-ios.
Hello @taflanidi
How are u this fine morning? Great to here from u!
We are usang the new item feature found in iOS12 where u can paste ur phone number directly from the keyboard.
In the examples, there isnt no support for pasting phone number and supporting the mask. Can u help us out?
from input-mask-ios.
Guess you're talking about suggestions based on textField.contentType
which you've set to phone number?
from input-mask-ios.
Hey @patthehuman!
I'm not sure what exactly you are talking about, but I assume @LinusGeffarth had guessed right, and you are having trouble with the suggestions based on the contentType
.
Unfortunately, there's no simple way for our library to support these automatic suggestions.
The library heavily relies on this false
right here, returned from the textField(shouldChangeCharactersInRange:replacementString:)
call, which prevents pasting suggested text.
From what I've found, suggested phones pasting is a two-step process. There are two separate consecutive calls. First, the contents of the UITextField
are replaced with a single space " "
string. Then this single space is replaced with the expected phone number.
In case when your UITextField
denies the first step, second step doesn't occur at all, which is our problem. We can't say whether this first step is simply user trying to fill the field with garbage or whether it's the system's try to put suggested phone number. Hence, the library can't return true
from the textField(shouldChangeCharactersInRange:replacementString:)
call.
For some reason system's keyboard can't replace the whole text with suggested phone number at once. This could've solved the problem; in fact, there would've been no problem at all in the first place.
I don't want to put an unreliable hardcode into the sources just because nobody at iOS SDK development team thought it might be a good idea to put some nice callbacks on events such as inserting autotext.
Please let me know, if this answers your question.
from input-mask-ios.
When the " "
is passed, we could hard-codedly check for that and then trim the text's whitespaces and still return true.
Right?
from input-mask-ios.
Related Issues (20)
- can you add tailplaceholder as parameter, like MaskedTexfieldDelegate(primaryFormat: [99] / [99], isTailPlaceholderVisible: true) HOT 3
- Move the list of countries to an external file⦠maybe?
- fix put when primaryMaskFormat "7 ([999])", if we use put("788", textfield) and if string first char is 7 mask will remove it, output: "7 88" HOT 8
- Update the wikis
- Obtain text field value without input-mask HOT 1
- first number of format is wrong with prefix HOT 2
- Being able to use the `UITextField` delegates HOT 11
- First number of mask(#104) HOT 17
- Automatic Caps Lock Activation Issue in MaskedTextField HOT 7
- Install in macOS project HOT 2
- Multiple Swift compiler Errors: * is only available in tvOS 10.0 or newer HOT 2
- IOS Objective-C Programmatically example HOT 1
- [!] Unable to determine Swift version for the following pods HOT 1
- Unable to use with single textField HOT 2
- How to define ${dynamic amount }/month in input mask HOT 1
- How to write uppercased text? HOT 2
- Number Formatting (Thousand Separator) HOT 3
- Poor performance when user types fast HOT 3
- can you make mask template always visible while user input text HOT 2
- My repo
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 input-mask-ios.