Skip to content

Double tap navigates twice #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
unremarkablegarden opened this issue Sep 15, 2020 · 1 comment
Closed

Double tap navigates twice #57

unremarkablegarden opened this issue Sep 15, 2020 · 1 comment

Comments

@unremarkablegarden
Copy link

If I quickly tap a link twice, it opens the sub-page twice on top of each other. Need to tap "back" twice to get home again.

template:
<StackLayout v-for='(post, index) in resources[path]' :key='index' @onTap='viewPost(post)'>

method:

viewPost(post) {
    this.$navigateTo(ItemDetails, {
        frame: 'navigator',
        props: {
            item: post,
            animated: true,
            type: 'news' 
        }
    }).catch(error => console.log(error))
},
@rigor789
Copy link
Member

If you tap twice - the event is fired twice, nothing that the Navigator should fix. In general, you need to debounce your viewPost method - there are many ways to do it, just look for js debounce or vue debounce method.

I would do something like (not tested this - only from memory):

npm install debounce

import debounce from 'debounce'

// ...

viewPost: debounce(function() {
    this.$navigateTo(ItemDetails, {
        frame: 'navigator',
        props: {
            item: post,
            animated: true,
            type: 'news' 
        }
    }).catch(error => console.log(error))
}, 200)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants