A React hook which executes a given callback when the hardware back button is pressed.
import { useBackButton } from "react-native-app-helpers";
const ExampleScreen = () => {
useBackButton(() => {
alert(`The back button was pressed.`);
});
return null;
};