How to disable swipe-to-go-back gesture on one page only? (Ionic v5 React)

Use createGesture to override the default swipe back gesture.

use gesturePriority > 40 because of the ionic source code

let gesture = createGesture({
        el: document.getElementById('myIonPage'),
        threshold: 0,
        gestureName: 'my-gesture',
        gesturePriority: 40.5, // priority of swipe to go back is 40 
        onMove: ev => console.log(ev)
      });

gesture.enable(true);

Use createAnimation ,if you want to customize the animation as well.

4 Likes