Giter VIP home page Giter VIP logo

Comments (8)

taflanidi avatar taflanidi commented on August 18, 2024 1

Hello @margulan97!
Thanks for your report.

That's an expected behaviour. Acts the same as if you paste text into the empty field.

from input-mask-ios.

margulan97 avatar margulan97 commented on August 18, 2024

but for example: if primaryMask "6 [999]", put("699", textfield) output = "6 99",
but if first char is not 6 put("999", textfield) output = "6 999", this bug appears only when the first digit in the mask is the same as first digit in put. is that correct behavior?

from input-mask-ios.

margulan97 avatar margulan97 commented on August 18, 2024

you don't know which part of the code I need to look at to fix the bug?when I debug In apply func in the Mask class and character is not inserted to modified string. a try to check valueState override func accept(character char: Character) -> Next?. but there is no logic that will cause it. if it's not difficult for you to point out which part of the code I should look at to find a solution. thank for reply

from input-mask-ios.

taflanidi avatar taflanidi commented on August 18, 2024

put("999", textfield) output = "6 999"

Yep, this is also a correct behaviour. When you paste 999 from clipboard, you'd expect all of your digits to be utilised, so the library doesn't cut anything but puts a prefix before the string.

you don't know which part of the code I need to look at to fix the bug?

Could you please elaborate a little bit more on where the 699 value comes from? The solution would rather depend on it.

For instance, if 699 is a documented value which comes from your backend APIs, and if you know it's always three digits, then the problem is obviously a "frontend rendering" issue; the value will always lack the necessary 6 prefix, thus it's okay to insert it everywhere like you did.

If 699 is stored mobile-wise, I'd rather change the mask format to {6} [999] and store whole 4-digit values with prefixes.

Long story short, the meaning behind this prefix dictates the solution.

from input-mask-ios.

margulan97 avatar margulan97 commented on August 18, 2024

I have phonenumberfield that apply this mask "+7 ([999]) [999]-[99]-[99]" and value comes from backend like "1234567890" and output was "+7 (123) 456-78-90", but if I have seven in the first string "7234567890" output was like "+7 (234) 567-89-0", I need to mask can able to paste 10 digits from mask.

from input-mask-ios.

taflanidi avatar taflanidi commented on August 18, 2024

So basically the meaning behind the value returned from your backend is "phone number without the country code".

Thus, the country code itself is just a UI thing, and you've got to prefix all the values that are coming from your backend with 7; the library will do the rest.

from input-mask-ios.

taflanidi avatar taflanidi commented on August 18, 2024

Feel free to reopen should you have any additional questions.

from input-mask-ios.

margulan97 avatar margulan97 commented on August 18, 2024

can you help me where I can fix that behavior, because I have multiple masks that comes from backend and I need to fill it correctly now I fix it only for phone number case.

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.