blob: b338af5e4d0d99277bded5ec21929840dabcb743 (
plain) (
blame)
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
|
import "@/globals.css";
import "expo-dev-client";
import { useEffect } from "react";
import { View } from "react-native";
import { useRouter } from "expo-router";
import { Stack } from "expo-router/stack";
import { useShareIntent } from "expo-share-intent";
import { StatusBar } from "expo-status-bar";
import { useLastSharedIntent } from "@/lib/last-shared-intent";
import { Providers } from "@/lib/providers";
export default function RootLayout() {
const router = useRouter();
const { hasShareIntent, shareIntent, resetShareIntent } = useShareIntent();
const lastSharedIntent = useLastSharedIntent();
useEffect(() => {
const intentJson = JSON.stringify(shareIntent);
if (hasShareIntent && !lastSharedIntent.isPreviouslyShared(intentJson)) {
// TODO: Remove once https://github.com/achorein/expo-share-intent/issues/14 is fixed
lastSharedIntent.setIntent(intentJson);
router.replace({
pathname: "sharing",
params: { shareIntent: intentJson },
});
resetShareIntent();
}
}, [hasShareIntent]);
return (
<Providers>
<View className="h-full w-full bg-white">
<Stack
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen name="index" />
<Stack.Screen
name="sharing"
options={{
presentation: "modal",
}}
/>
</Stack>
<StatusBar style="auto" />
</View>
</Providers>
);
}
|