Especializa / nativescript-ng-shadow

Angular directive to apply shadows to native elements according to the elevation level guidelines of material design specification
Apache License 2.0
54 stars 38 forks source link

Is this plugin works on Button? #10

Closed LHLK closed 6 years ago

LHLK commented 6 years ago

Hello there, I'm just wondering whether or not this plugin works on Button element? I tried to change around in your demo by changing the Label to Button tag; however, the shadow seems couldn't hold. Please advice. Thanks. LH

berardo commented 6 years ago

Honestly, I think it's not an issue with this plugin, but something to do with the underlying Android natural behaviour. You might find this link more explanatory but the bottom line is Android buttons are split into three categories, floating, raised and flat and, different from labels and other ui elements, each button category has its own state animator. So, when buttons as tapped, Android does affect their elevation (and z translation) in a way that Angular is not notified. Notice that Angular and ZoneJS are pretty extensive on browsers, they monkey patch every asynchronous events to be 100% aware of all changes, but sadly the same is not always true for Nativescript. You will have to find a way re-apply the bound data to your buttons after they have been tapped or go all the way around and use any component other than button and, if you miss the button natural behaviour, apply things like raising and ripple. Sorry for not having any better idea of the top of my head.

berardo commented 6 years ago

Should be addressed by release 2.1.0