How to disable swipe gestures for iOS?

Hello everyone, I am developing a native mobile app where users are not allowed to manually go back to previous pages. Disabling the hardware back-button on Android was no problem. I can’t figure out a way to disable the swipe gesture on iOS, which enables users to pop the react-native navigation stack. From what I’ve researched, the solution would be to change the configuration of the stack navigator. But I assume that this code is generated by the Modeler and there is no way for me to change or override its behavior. Or can I? This is what I’d have to change:   Thanks!
2 answers

I found a temporary solution that is a bit of a hack I suppose. Nevertheless, it works for now. Please note that this solution will, as far as I can tell, disable all swipe gestures for the entire app (You can still use the gesture to bring up the iOS shortcuts though). Also, this solution only applies to building with anything but the Make-it-Native App, unless you can figure out how to modify the iOS bundle.

Anyway, here goes:

Say you’re building with MS App Center, clone the latest build branch and edit the index.ios.bundle file in /ios/Bundle.

Search the following code:

{key:"isGestureEnabled",value:function(){var t=this.props.transitionProps.scene.descriptor.options.gesturesEnabled;return'boolean'==typeof t?t:'ios'===y.Platform.OS}}

Replace it with:

{key:"isGestureEnabled",value:function(){return false}}

Now you can go back to MS App Center and trigger another build with that branch. You’ll have to this modification every time you make a new build with the Native-Builder...




Well, it is a solution :D