Reputation: 943
I have a NativeScript application running and now I want to change the background color of my button when it is pressed (so that the user can see, that he really pressed it). After some googling I found that documentation. So I tried to apply these to my code (sadly I am not initializing my button via TS, so I cannot use the btn = new buttonModule.Button();
line.
My html:
<Button [text]="'SIGNIN'|translate" (onTap)="passCredentials()"></Button>
My css:
Button {
background-color: rgba(255, 230, 0, 1);
font-weight: bold;
margin-left: 10;
margin-right: 10;
padding: 10;
height: 50;
margin-top: 30;
margin-bottom: 25;
}
Button:pressed {
background-color: red;
}
That's what I tried, but he is neither throwing an error nor changing the background-color. Do I need to tell him manually to switch between these classes? How could I do that?
Upvotes: 0
Views: 1377
Reputation: 1754
No need to write css by yourself you can use NativeScript core theme
.
Add one of the core theme to your app.css
file and then you can use btn
and btn-primary
class to your Button
component.
Here I am sharing link for reference to import core theme to your app.css
Upvotes: 1
Reputation: 2582
Try with highlighted
pseudo selector:
Button:highlighted{
background-color: red;
}
Upvotes: 1