JoshDSommer / nativescript-ngx-shadow

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

Button with shadow is slow to render on Android #16

Closed edusperoni closed 5 years ago

edusperoni commented 5 years ago

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

  1. Enable timeline view: https://www.nativescript.org/blog/deep-dive-into-nativescript-3.1-performance-improvements
  2. <Button shadow="4"></Button>

Result:

image

Yes, that's 600ms to create a button.

Additional context

We it to a label and that got rid of the issue. I believe this is an issue with the state animator (maybe it's too heavy?). Using forcePressAnimation=true with a Label also takes 600ms to create. What's weird about this is that no matter how many Labels you have, only a single instance of a 600ms load will take place, even when they are all the same. Destroying and recreating the component (via *ngIf) also only shows slowdown on the first load.

edusperoni commented 5 years ago

Further testing needed with 5.3. This might have been an issue with code generation, which was refactored: https://github.com/NativeScript/android-runtime/issues/689

edusperoni commented 5 years ago

Ok, what the actual hell.

https://play.nativescript.org/?template=play-ng&id=28zxPb

Just calling android.R.integer.config_shortAnimTime and other android.R stuff adds 500ms to the time. andoird.R.integer is a static Java class... I'll have to open an issue with NS to check this

edusperoni commented 5 years ago

I confirmed that reading android.R variables make the application lag.

Demo application: https://play.nativescript.org/?template=play-ng&id=28zxPb&v=6

I'll check if the same happens on NS 5.3 and open an issue if it does