aboutsummaryrefslogtreecommitdiffstats
path: root/packages/mobile/app/_layout.tsx
blob: bd269060e9278e94bd3b69a983baf482320a4bd1 (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
import "@/globals.css";
import "expo-dev-client";

import { Slot, useRouter } from "expo-router";
import { useShareIntent } from "expo-share-intent";
import { StatusBar } from "expo-status-bar";
import { useEffect } from "react";
import { View } from "react-native";

import { Providers } from "@/lib/providers";

export default function RootLayout() {
  const router = useRouter();
  const { hasShareIntent, shareIntent, resetShareIntent } = useShareIntent();

  useEffect(() => {
    if (hasShareIntent) {
      router.replace({
        pathname: "sharing",
        params: { shareIntent: JSON.stringify(shareIntent) },
      });
      resetShareIntent();
    }
  }, [hasShareIntent]);
  return (
    <Providers>
      <View className="h-full w-full bg-white">
        <Slot />
        <StatusBar style="auto" />
      </View>
    </Providers>
  );
}