Nativescript: Support :highlighted attribute for Layout components

Created on 22 Sep 2017  路  9Comments  路  Source: NativeScript/NativeScript

Please support the :highlighted selector for StackLayout, FlexboxLayout, etc. It is not possible to create a button with nested images/text. It is not possible to create a StackLayout/GridLayout/FlexboxLayout for use as a button and have it change the background color on press.

https://github.com/NativeScript/NativeScript/issues/50


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

css feature

Most helpful comment

in terms of UI, this would be a very nice feature to add, since I came across the lack of this functionality from the first project

All 9 comments

Any suggestions how to implement?

in terms of UI, this would be a very nice feature to add, since I came across the lack of this functionality from the first project

Why only "Layout components"? All View components/widgets need this.

This works on Android: https://github.com/tbsf/NativeScript/commit/cc5caaec6d2e44da2f74c8d5a551dab97e13c878

I'm developing on Linux so I cannot implement fix on iOS at this time.

EDIT: Probably as simple as moving this to layout-base for iOS: https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/button/button.ios.ts#L44

+1

@tjvantoll Is this possible?
It would be very useful.

+1

Any progress? Also interested in this feature.

@sashok1337 see my earlier comment how I implemented for android. Code has changed since then but you just need to add PseudoClassHandler to the layout base https://github.com/NativeScript/NativeScript/blob/master/nativescript-core/ui/layouts/layout-base.android.ts

You can look at the button class for iOS to see how PseudoClassHandler is implemented there. It鈥檚 not difficult. Unfortunately I didn鈥檛 have access to iOS to test so I never created a PR.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rLoka picture rLoka  路  3Comments

dhanalakshmitawwa picture dhanalakshmitawwa  路  3Comments

Pourya8366 picture Pourya8366  路  3Comments

NordlingDev picture NordlingDev  路  3Comments

guillaume-roy picture guillaume-roy  路  3Comments