I want to prevent the user from going back to the previous screen. So I added code, but this does not work. Are there any solutions for this? The alert pop up is seen but \"
If you are using react-natigation then you need to use BackHandler instead of BackAndroid
BackHandler
BackAndroid
import { BackHandler } from 'react-native'; // code componentDidMount() { BackHandler.addEventListener('backPress'); } // some more code componentWillUnmount() { BackHandler.removeEventListener('backPress'); }