-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
43 lines (38 loc) · 1.14 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
import "react-native-get-random-values";
import { Amplify } from "aws-amplify";
import awsconfig from "./src/aws-exports";
import { SafeAreaView } from "react-native-safe-area-context";
import * as WebBrowser from "expo-web-browser";
import { MainNavigator } from "./src/navigators";
import { AuthContextProvider } from "./src/contexts/auth-context";
import { Linking, Platform } from "react-native";
import { Client } from "./src/apollo/client";
import { MenuProvider } from "react-native-popup-menu";
async function urlOpener(url: string, redirectUrl: string) {
const result = await WebBrowser.openAuthSessionAsync(url, redirectUrl);
if (result.type === "success" && Platform.OS === "ios") {
WebBrowser.dismissBrowser();
return Linking.openURL(result.url);
}
}
Amplify.configure({
...awsconfig,
oauth: {
...awsconfig.oauth,
urlOpener,
},
});
function App() {
return (
<SafeAreaView className="flex-1">
<MenuProvider>
<AuthContextProvider>
<Client>
<MainNavigator />
</Client>
</AuthContextProvider>
</MenuProvider>
</SafeAreaView>
);
}
export default App;