toniantunovi / ion-bottom-drawer

Bottom drawer component for Ionic 4
63 stars 16 forks source link

Suggestion: change property to "transform" instead of "top" for improved performance. #2

Closed torsorensen closed 6 years ago

torsorensen commented 6 years ago

Hi, nice and simple. Is there a reason why you're not using "transform: translateY" instead of "top"? With transform you're not recalculating the DOM and thus it should be better for performance.

toniantunovi commented 6 years ago

Hi. Thanks for this great suggestion. I'll try to find time and update the code by the end of the week.

torsorensen commented 6 years ago

No problem :) It's a very straightforward edit (search/replace) which improved performance quite a bit for me when running on actual devices using ionic3 and a modified version of joshmorony's drawer (very identical to yours).

One thing to note is that with transform, you would need to use this.element.nativeElement.getBoundingClientRect().top; to get the offset of the drawer.

toniantunovi commented 6 years ago

Hi, I've implemented suggested improvement so I'm closing the issue.