Disable Swipe to previous screen (some android and IOS)

Hi ,


i'm facing a problem in my mobile app. I used backbutton component to avoid user to back to previous screen and everything was good. But now i've got  another problem !

There are some androids that can swipe with gesture in screen to back to previous screen.

anyone knows how can i disable the swipe in screen to avoid user do that?

kind regards

await for your answers ;)

Hi Hugo,

Try adding the following javascript in the OnInitialize of the screen you want to block the swipe behaviour:


document.addEventListener('touchstart', function(e) {

    // is not near edge of view, exit

    if (e.pageX > 10 && e.pageX < window.innerWidth - 10) return;


    // prevent swipe to navigate gesture

    e.preventDefault();

});


Let me know if it works!

Thank you @Carolina Salgueiro ! It works fine ! Perfect ;)


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.