bradleygore / nativescript-textinputlayout

Android Material Design TextInputLayout for NativeScript
36 stars 14 forks source link

secure="true" ignored on TextField #23

Closed benjaminhorner closed 6 years ago

benjaminhorner commented 6 years ago

Secure input is ignored.

        <TextInputLayout 
            class="form-input"
            hint="{{ user.passwordHint }}"
            hintAnimationEnabled="true"
            hintTextAppearance="SpecialTextInputLayout"
            [tintColor]="textInputLayout.tintColor"
            [lineColor]="textInputLayout.lineColor"
            [selectedTitleColor]="textInputLayout.selectedTitleColor"
            [selectedLineColor]="textInputLayout.selectedLineColor">
              <TextField 
                #passwordTextField
                id="passwordTextField"
                [editable]="!isLoading"
                [(ngModel)]="user.password" 
                autocorrect="false" 
                autocapitalizationType="none"
                secure="true"
                returnKeyType="done"
                returnPress="submit()">
              </TextField>
          </TextInputLayout>

The secure="true" does not work with textinputlayout added.

chuckmitchell commented 6 years ago

I also have this issue on iOS 11.0.3 Works fine on android.

chuckmitchell commented 6 years ago

The issue here might be that you are not using a single TextInputLayout tag for iOS as described in the instructions.

benjaminhorner commented 6 years ago

@chuckmitchell I tried making it the bare minimum on iOS: a single TextInputLayout tag and a single secure TextView… and it does not resolve the issue. Moreover, If I do a single TextInputLayout tag, I cannot set the hint for each TextView individually. I am not sure te documentation says you should use a single tag for iOS. I think it just means a single child tag. @bradleygore ?

bradleygore commented 6 years ago

There should NOT be a nested TextField with iOS. The docs are very explicit about that:

https://github.com/bradleygore/nativescript-textinputlayout#ios

<TIL:TextInputLayout
    hint="{{ hint }}"
    isEnabled="{{ isEnabled }}"
    disabledColor="#c3c3c3"
    error="{{ error }}"
    text="{{ demoText }}"
    title="{{ title }}"
    color="{{ error ? '#aa0000' : '#d745ff' }}"
    tintColor="#d745ff"
    lineColor="#d745ff"
    selectedTitleColor="#ff45ca"
    selectedLineColor="#7a45ff"
    lineHeight="1.25"
    selectedLineHeight="3.5" />
bradleygore commented 6 years ago

@benjaminhorner - also, you can set the hint for each TextInputLayout individually (providing your variables backing the value are individualized...) as they are individual instances and in no way relating to one another... Please review the demo - there are multiple fields all with different hints in the demo app.

benjaminhorner commented 6 years ago

@bradleygore : thanks for your response. My bad. I had wrongly understood the docs. It all works now.

bradleygore commented 6 years ago

Styling issue is separate, so I'll only address secure here: The ios version of this simply inherits from the nativescript TextField (see here). If the TextField supports secure on iOS, then great - this should too just as it supports the text property. I am not sure why it would not support it exactly the same.

bradleygore commented 6 years ago

@benjaminhorner - was this closed because it ended up working, or some other reason?

benjaminhorner commented 6 years ago

@bradleygore yes it works. So does the styling… partially. Padding does not work.