Is it possible to disable the hardware backButton from popping when a modal is visible?
I'm using a load screen in a modal scene but users on Android can easily press on the back button which will make the load screen pop, even though the data hasn't even loaded yet..
import {BackAndroid} from 'react-native'
then in your component...
componentWillMount() {
// Disable back button by just returning true instead of Action.pop()
BackAndroid.addEventListener('hardwareBackPress', () => {return true});
}
Why, not practical /reset/ this method
This is not working for me on RN 0.48, ReactNavigation 2.0 with
componentWillMount = () => BackHandler.addEventListener('hardwareBackPress', () => true);
Most helpful comment
import {BackAndroid} from 'react-native'
then in your component...