android 에서 백버튼으로 앱 종료를 구현했는데
종료되지 않고 백그라운드에서 계속 실행중인 이슈가 있었다
BackHandler.exitApp()이후에
return true 를 주어 해결
https://stackoverflow.com/questions/52255920/react-native-android-backhandler-exit-app
const backAction = () => {
Alert.alert('app exit', '정말 앱을 종료하시겠습니까?', [
{
text: '취소',
onPress: () => null,
style: 'cancel',
},
{
text: '확인',
onPress: () => {
BackHandler.exitApp();
return true;
},
},
]);
return true;
};
React.useEffect(() => {
const backHandler = BackHandler.addEventListener(
'hardwareBackPress',
backAction,
);
return () => backHandler.remove();
}, []);