Giter VIP home page Giter VIP logo

Comments (6)

taflanidi avatar taflanidi commented on August 18, 2024 1

@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.

taflanidi avatar taflanidi commented on August 18, 2024

Hey @patthehuman!
Thanks for your question.

Could you please be more specific about the scenario you are having trouble with?

from input-mask-ios.

patthehuman avatar patthehuman commented on August 18, 2024

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.

LinusGeffarth avatar LinusGeffarth commented on August 18, 2024

Guess you're talking about suggestions based on textField.contentType which you've set to phone number?

from input-mask-ios.

taflanidi avatar taflanidi commented on August 18, 2024

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.

LinusGeffarth avatar LinusGeffarth commented on August 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.