Textfield - changing the secure value changing font css
See original GitHub issueDid you verify this is a real problem by searching [Stack Overflow]
Yes, I found this -> Issue number 3221 - but it didn’t help me.
Tell us about the problem
I created a “password” textfield and a button of “show-hide” that responsible for changing the “secure” value of the mentioned textfield. The problem in when I press the “show-hide” button the font css properties change.
This is a video on the problem in my end -> Problem video Notice that in the video the font style change is happens also on the hint text.
Which platform(s) does your issue occur on?
Android. Didn’t check on IOS.
Please provide the following version numbers that your issue occurs with:
- CLI: 3.1.2
- Cross-platform modules: 3.1.0
- Runtime(s): 3.1.1
Please tell us how to recreate the issue in as much detail as possible.
Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.
html file.
<StackLayout>
<StackLayout orientation="horizontal">
<Label text="Password" class="field-label"></Label>
<Label [text]="passwordSecureModeText" class="show-hide-text" (tap)="secureModeChange()"></Label>
</StackLayout>
<TextField class="field-text-area" [hint]="Password" [secure]="passwordSecureMode" [(ngModel)]="password"></TextField>
</StackLayout>
ts file
export class SignUpComponent {
public password: string;
public passwordSecureMode: boolean = true;
public passwordSecureModeText: string = "Show";
private secureModeChange() {
this.passwordSecureMode = !this.passwordSecureMode;
this.passwordSecureModeText = this.passwordSecureMode ? "Show" : "Hide";
}
}
css file
.field-label {
color: #f2f2f2;
font-family: 'Product Sans',Arial,sans-serif;
font-size: 22px;
font-weight: 300;
}
.show-hide-text {
color: #f2f2f2;
font-family: 'Product Sans',Arial,sans-serif;
font-size: 14px;
font-weight: 100;
vertical-align: center;
margin-left: 50px;
margin-right: 50px;
}
.field-text-area {
color: #f2f2f2;
border-bottom-color: #f2f2f2;
font-family: 'Product Sans',Arial,sans-serif;
font-size: 18px;
font-weight: 100;
placeholder-color:#f2f2f2;
}
Hope that is enough information. 😃
Thank you!
<bountysource-plugin>Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Changing The Font Of Text Area - Stack Overflow
The only way I could get it to work was to set the textarea's CSS specifically to font-family: inherit; font-size: inherit; then applying...
Read more >Fundamental text and font styling - Learn web development
Here we'll go through all the basic fundamentals of text/font styling in detail, including setting font weight, family and style, font ...
Read more >Change font style and size in Rich Text field - BMC Communities
I created one more rich text field and set below value in this. and then used REPLACE fumnction to replace #$$TextToCon$$# with above...
Read more >How do I change the font size for the input fields? - Jotform
You can inject CSS code to change the input field's font size. You can find here some sample codes to alter the texts...
Read more >HTML DOM Style fontWeight Property - W3Schools
Set the font weight for an element to "900": · ("demo").style.fontWeight = "900"; ; A demonstration of possible values: var listValue = selectTag.options[ ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Here is a workaround for this (tested on android only - but should be compatible with ios)
This helped me for finding the workaround: https://github.com/chrisjenx/Calligraphy/issues/186
Wait until TextField is loaded (tfLoaded)
The loaded function:
updateVisibility() looks like this:
and somewhere there is the toggle button (in my case the eye symbol):
so for iOs nativescript should do all the work [ios:secure]=“!showPassword” For android we do all the work in updateVisibility()
Edit: Fixed formatting Edit2: changed [ios:secure]=“!showPassword” to ios:secure=“{{!showPassword}}” Edit3: I realized that ios:secure=“{{!showPassword}}”/[ios:secure]=“!showPassword” on TextField was not a good solution. It was also affecting the android Textfield style. Therefore I change the secure value for iOS only via code. I updated the post to show the changes