aboutsummaryrefslogtreecommitdiffstats
path: root/packages/mobile/app
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-03-11 09:39:23 +0000
committerMohamedBassem <me@mbassem.com>2024-03-11 09:41:32 +0000
commitbffbb94201a5637cb6b55b59b499fb0ec67218d6 (patch)
tree52511960c63e5b427d599256ffd549f0932650ca /packages/mobile/app
parent1f3a162fde79dbf9102d2e3f67cfc6b6e2e302e9 (diff)
downloadkarakeep-bffbb94201a5637cb6b55b59b499fb0ec67218d6.tar.zst
mobile: Setup share intent
Diffstat (limited to 'packages/mobile/app')
-rw-r--r--packages/mobile/app/_layout.tsx21
-rw-r--r--packages/mobile/app/signin.tsx2
2 files changed, 20 insertions, 3 deletions
diff --git a/packages/mobile/app/_layout.tsx b/packages/mobile/app/_layout.tsx
index 7403c6ff..c578d07f 100644
--- a/packages/mobile/app/_layout.tsx
+++ b/packages/mobile/app/_layout.tsx
@@ -1,12 +1,29 @@
import "@/globals.css";
+import "expo-dev-client";
-import { Slot } from "expo-router";
+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";
export default function RootLayout() {
+ const router = useRouter();
+ const { hasShareIntent, shareIntent, resetShareIntent } = useShareIntent({
+ debug: true,
+ });
+
+ useEffect(() => {
+ if (hasShareIntent) {
+ router.replace({
+ pathname: "shareintent",
+ params: { shareIntent: JSON.stringify(shareIntent) },
+ });
+ resetShareIntent();
+ }
+ }, [hasShareIntent]);
return (
- <View className="w-full h-full bg-white">
+ <View className="h-full w-full bg-white">
<Slot />
<StatusBar style="auto" />
</View>
diff --git a/packages/mobile/app/signin.tsx b/packages/mobile/app/signin.tsx
index f500e36e..491f3007 100644
--- a/packages/mobile/app/signin.tsx
+++ b/packages/mobile/app/signin.tsx
@@ -6,7 +6,7 @@ import { Input } from "@/components/ui/Input";
export default function Signin() {
return (
- <View className="container justify-center h-full flex flex-col gap-2">
+ <View className="container flex h-full flex-col justify-center gap-2">
<View className="items-center">
<Logo />
</View>