PeterStaev / nativescript-masked-text-field

:hash: A NativeScript Masked Text Field widget
Apache License 2.0
25 stars 24 forks source link

Dont works with ReactForms #19

Closed domzinhuu closed 6 years ago

domzinhuu commented 6 years ago

i'm try use this plugin with reactforms but no success. I receive the error

ERROR Error: No value accessor for form control with name: 'cpf'

Has some chance to use this with formControl,formGroup?

PeterStaev commented 6 years ago

Hey @domzinhuu , from what I see from the code here: https://github.com/PeterStaev/nativescript-masked-text-field/blob/deec2627c7f0082c342e2fc1cd73a75c15f99fff/angular/index.ts#L24-L27

it should be working fine. Can you provide the actual html snippet? Also have you registered the module?

domzinhuu commented 6 years ago

i'm try use in html with this with angular: <MaskedTextField formControlName="cpf" [class.field-invalid]="dataForm.get('cpf').invalid && submited" returnKeyType="next" keyboardType="number" [hint]="'hint.cpf' | L" mask="999.999.999-99"></MaskedTextField>

and import this module MaskedTextFieldModule

PeterStaev commented 6 years ago

Thanks for the details. I think I found the problem and will try to fix it soon.

domzinhuu commented 6 years ago

Ok, Thank you.

PeterStaev commented 6 years ago

@domzinhuu , the new version on npm should have this resolved.

domzinhuu commented 6 years ago

@PeterStaev many thanks for the fast solution 👍

domzinhuu commented 6 years ago

@PeterStaev, another problem appeared, The hint property of textfield dont works anymore. can you see this

nickykln commented 6 years ago

Hi Guys, Hi @PeterStaev

I am facing a problem that looks like this one but it is strange because this bug is 2 years old :(

I have the following ReactForm

<StackLayout [formGroup]="codeForm">

  <label
    class="heading2-form"
    text="Nous l'avons envoyer au numéro "
  ></label>
  <MaskedTextField
    #codeInput
    formControlName="codeInput"
    text=""
    class="code-verification"
    mask="9 9 9 - 9 9 9"
    [isEnabled]="!loading"
    keyboardType="phone"
    autocorrect="false"
    autocapitalizationType="none"
    (textChange)="onKeyPressed()"
  ></MaskedTextField>

And I get the same error : JS: ERROR Error: No value accessor for form control with name: 'codeInput' JS: ERROR CONTEXT { JS: "view": { JS: "def": { JS: "nodeFlags": 403326977,

If you can find a little bit of tilme for answering, I would really appreciate.

Thanks a lot,

N

PeterStaev commented 6 years ago

Hey @nickykln , I cannot simulate this behavior. Please refer to the following playground: https://play.nativescript.org/?template=play-ng&id=34i0a5

nickykln commented 6 years ago

Hi @PeterStaev, Thanks a lot for your quick answer. I have copied/pasted your working code and it is not working in my environment. The main difference is that I have upgraded to angular 7.0.0.

[Mod 11/11/2018] : I have downgrade to 6.1.10 : Same behaviour :(

Do you know if this is a way to upgrade playground for using angular 7 ?

I keep on investigating, and let you know but thanks again.

Nicolas

PeterStaev commented 6 years ago

Angular 7.0 is not supported yet in NS. See https://www.nativescript.org/blog/nativescript-5.0-is-hot-out-of-the-oven . NG 7.0 support is coming in a future release.

yassernasc commented 5 years ago

i was testing with angular 7 and tns 5, doesn't work. :/

PeterStaev commented 5 years ago

Hey @yassern , I just tried the plaground above (which from what I know is updated to the latest NS + NG) and it still works. If you are having problems please submit a new issue and provide a reproducible example via the NativeSript Playground.

Since this issue is 1+ year I'm locking conversation so users are forced to submit a new issue and provide specific details.