Zipline-Android-App/hooks/useShareIntent.ts
2025-02-08 21:36:49 +01:00

21 lines
560 B
TypeScript

import { useRouter } from "expo-router";
import { useShareIntentContext } from "expo-share-intent";
import { useEffect } from "react";
export const useShareIntent = (skipRedirect = false) => {
const router = useRouter();
const { hasShareIntent, resetShareIntent } = useShareIntentContext();
if (skipRedirect) return resetShareIntent;
// biome-ignore lint/correctness/useExhaustiveDependencies: .
useEffect(() => {
if (hasShareIntent) {
router.replace({
pathname: "/shareintent",
});
}
}, [hasShareIntent]);
return resetShareIntent;
};