Environment
Describe the bug
I have two built versions with {N} 6.0 and {N} 5.4.3, on the older built, the (tap) events works as expected and without any lags, but on the newer built, I can feel a lag of about 1 second or less before it executes the function assigned to the event.
Any body else having the same experience or there is something wrong with my {N} 6.0 built?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Hi @hamidbsd,
I tested the tap event and the other gesture with our examples linked below, however, was unable to recreate similar problem.
https://github.com/NativeScript/nativescript-sdk-examples-ng/tree/master/app/ng-ui-widgets-category/button/tap-event
https://github.com/NativeScript/nativescript-sdk-examples-ng/tree/master/app/ng-ui-widgets-category/gestures
On that matter, can you provide a sample app, where the issue can be reproduced?
Hi, @hamidbsd & @tsonevn
Same problem for me, there is a lag of about 1 second during a tap on a Label with {N} 6.0, no lag with the same application on {N} 5.4.3.
On my side, there is no lag when the action is triggered after a tap on a Button.
Hi @jbarnabe
Just checked. You are right. There is no lag when tap is triggered on a Button. However there is lag on pretty much everything else including Image, Label and Layouts.
Hi,
after upgrading to {N} 6, I have the same experience. To reproduce the problem, create a sample app: {N} + Angular with SideDrawer template and insert <Button>
as the navigation item. The difference between tap on generated nav item (<StackLayout>
) and the inserted <Button>
is significant.
(The sample code is a little dirty, but it is sufficient to reproduce the problem.)
Sample code (SideDrawer part) {N} 6:
<RadSideDrawer [drawerTransition]="sideDrawerTransition">
<GridLayout tkDrawerContent rows="auto, *" class="sidedrawer sidedrawer-left">
<StackLayout row="0" class="sidedrawer-header">
<Label class="sidedrawer-header-image fa" text=""></Label>
<Label class="sidedrawer-header-brand" text="User Name"></Label>
<Label class="footnote" text="[email protected]"></Label>
</StackLayout>
<ScrollView row="1" class="sidedrawer-content">
<StackLayout>
<!-- (tap) causes lag -->
<GridLayout
columns="auto, *"
class="sidedrawer-list-item"
[class.selected]="isComponentSelected('/home')"
(tap)="onNavItemTap('/home')"
>
<Label col="0" text="" class="fa"></Label>
<Label col="1" text="Home" class="p-r-10"></Label>
</GridLayout>
<GridLayout columns="auto, *" class="sidedrawer-list-item">
<!-- (tap) doesn't cause lag -->
<Button class="btn btn-primary btn-active" id="button" text="Tap me!" (tap)="onNavItemTap('/browse')"></Button>
</GridLayout>
</StackLayout>
</ScrollView>
</GridLayout>
<page-router-outlet tkMainContent class="page page-content"></page-router-outlet>
</RadSideDrawer>
@ivan-rozhon thank you for providing the snippet - I can confirm that I am experiencing the same issue while testing with this POC app. While taps triggered from buttons are OK, any taps triggered from the drawer content (e.g. a nsRouterLink
) are considerably slower than the same in NativeScript 5.4 (or the same via a Button tap).
Marking this one as a bug on Android as I am not experiencing the issue on iOS. Please do let me know if you guys are hitting this one on iOS.
p.s. Even simpler demo can be seen while using this template app.
_Steps to reproduce:_
Result: The navigation via the Label tap is slower than the navigation through the Button tap.
After some tests, I can't reproduce this issue on iOS too. It seems to happen only on Android.
My guess the issue is caused by this: https://github.com/NativeScript/NativeScript/pull/7296/files#diff-a02e0fba93516f21a8cf4ddab2bb0e16R67
It doesn't check if there's a doubletap attached before calling setTimeout
, which means it'll wait for the double tap timer (which is around 300ms, IIRC)
Edit: Also, the reason it works with button is that NativeScript does not uses gestures for Button tap, but the actual OnClick listener, so that fires instantly.
@edusperoni We've also decided that waiting for double tap when there is no gesture recognizer attached is not right. If the PR get through we'll release the fix with the next patch this week.
Most helpful comment
@ivan-rozhon thank you for providing the snippet - I can confirm that I am experiencing the same issue while testing with this POC app. While taps triggered from buttons are OK, any taps triggered from the drawer content (e.g. a
nsRouterLink
) are considerably slower than the same in NativeScript 5.4 (or the same via a Button tap).Marking this one as a bug on Android as I am not experiencing the issue on iOS. Please do let me know if you guys are hitting this one on iOS.
p.s. Even simpler demo can be seen while using this template app.
_Steps to reproduce:_
Result: The navigation via the Label tap is slower than the navigation through the Button tap.