-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
39 lines (33 loc) · 957 Bytes
/
Copy pathApp.tsx
File metadata and controls
39 lines (33 loc) · 957 Bytes
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
32
33
34
35
36
37
38
39
import React, { useEffect } from 'react';
import { BackHandler, Alert } from 'react-native';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';
import Index from './src';
import { store, persistor } from './src/store';
export default function App() {
useEffect(() => {
const backAction = () => {
Alert.alert("Atenção!", "Tem certeza que deseja sair do aplicativo?", [
{
text: "Cancelar",
onPress: () => null,
style: "cancel"
},
{ text: "Sim", onPress: () => BackHandler.exitApp() }
]);
return true;
};
const backHandler = BackHandler.addEventListener(
"hardwareBackPress",
backAction
);
return () => backHandler.remove();
}, []);
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<Index />
</PersistGate>
</Provider>
);
}