I'm looking for a way to conditionally disable the swipe to go back gesture in react native iOS. I'm using the react-navigation library to control navigation. For Android, I am able to do it using BackHandler. Is it possible to do something similar in iOS?
componentDidMount() {
BackHandler.addEventListener("hardwareBackPress", this.handleBackButton);
}
handleBackButton = () => {
if (this.props.creating) {
return true; // Disables the back button in Android
}
};
componentWillUnmount() {
BackHandler.removeEventListener(
"hardwareBackPress",
this.handleBackButton
);
}