1

What I need: An active css effect for the button click (background-color of the button should change on clicking and holding it)

I have tried the following link: [https://docs.nativescript.org/ApiReference/ui/styling/HOW-TO.html]

page.css = "button:pressed { color: red; }";

Also tried applying the above style through stylesheet(.css)

I get no response in the UI(view) as given in the documentation.

Thanks in advance.

2 Answers 2

1

The section of the article that you are referring to is in the process of revision and it is not correct. We apologize for the misunderstanding!

States are currently not supported, so it will not be possible to change the color of the button while it is pressed. There is an open issue in the NativeScript repository in GitHub, where you can contribute and follow the discussion about state selectors.

However, you can change the color of the button after it has been pressed by using the tapEvent.

Sign up to request clarification or add additional context in comments.

1 Comment

The issue is now implemented and closed.
0

Try this

 button:active{
background:olive;
 }

and

 button:focus{
background:olive;
 }

2 Comments

Pseudo selectors are no supported in {N} yet.
@AndreyLuiz is this still accurate?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.