-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
86 lines (78 loc) · 2.06 KB
/
App.tsx
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React, { useEffect } from "react";
import "react-native-gesture-handler";
import { SafeAreaProvider } from "react-native-safe-area-context";
import {
SafeAreaView,
StatusBar,
StyleSheet,
useColorScheme,
PermissionsAndroid,
} from "react-native";
import { Amplify } from "aws-amplify";
import config from "./src/aws-exports";
import Navigation from "./src/navigation";
Amplify.configure(config);
const App: () => React.ReactElement<any> = () => {
const androidPermissions = async () => {
try{
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
{
title: "Permission d'accès à votre localisation précise",
message:
"Nous désirons accéder à votre localisation précise afin de vous proposer les Uber cars les plus proches.",
buttonNegative: "Demander ultérieurement",
buttonNeutral: "Annuler",
buttonPositive: "Ok",
},
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
// Do smthg
console.log("Fine Geolocation enabled!");
} else {
// Close App
console.warn("Fine Geolocation denied!");
}
} catch (e) {
console.warn(
"\n\nPermissionsAndroid.request ACCESS_FINE_LOCATION\n",
e,
);
}
};
useEffect(() => {
androidPermissions();
}, []);
return (
<SafeAreaProvider
initialMetrics={{
frame: { x: 0, y: 0, width: 0, height: 0 },
insets: { top: 0, left: 0, right: 0, bottom: 0 },
}}
>
{/*
<StatusBar
barStyle={
useColorScheme() === "dark"
? "light-content"
: "dark-content"
}
backgroundColor={"transparent"}
translucent={true}
/>
*/}
<Navigation />
</SafeAreaProvider>
);
};
const styles = StyleSheet.create({
backgroundStyle: {},
});
export default App;