반응형
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- fastapi
- linux
- IOS
- build
- 네트워크
- vsCode
- webpack
- node
- PYTHON
- Chrome
- MAC
- 맥
- 리눅스
- centos
- androidstudio
- 개발
- VirtualBox
- unittest
- localserver
- TensorFlow
- MachineLearning
- pydantic
- 오블완
- ReactNative
- 티스토리챌린지
- 센토스
- xcode
- react
- Android
Archives
- Today
- Total
로메오의 블로그
[React Native] Android Backkey 종료 처리 본문
반응형
App.tsx
...
import {BackHandler, Alert} from 'react-native';
const App = () => {
useEffect(() => {
const backAction = () => {
Alert.alert('', '앱을 종료하시겠습니까?', [
{text: '취소', onPress: () => null},
{text: '확인', onPress: () => BackHandler.exitApp()},
]);
return true;
};
const backHandler = BackHandler.addEventListener(
'hardwareBackPress',
backAction,
);
return () => backHandler.remove();
}, []);
return (
<View>
...
</View>
);
};
export default App;

반응형
'Frontend > React' 카테고리의 다른 글
| [React Native] 다국어 처리 - 언어별 앱이름 설정 (0) | 2022.12.18 |
|---|---|
| [React Native] 다국어 처리 - react-intl (0) | 2022.12.18 |
| [React Native] 프로모션 코드 발급하기 [Android 기준] (0) | 2022.12.13 |
| [공지] 리딤 코드(프로모션코드) 받아가세요~ (0) | 2022.12.12 |
| [React Native] Google Play 개발자 등록 (4) | 2022.12.09 |
Comments