expo-share-intent icon indicating copy to clipboard operation
expo-share-intent copied to clipboard

hasShareIntent is false

Open sudheersuri opened this issue 5 months ago • 3 comments

I tried to share url from reddit app and youtube app into my app but the hasShareIntent is false,

am using expo router and testing only for Android. I added shareintentprovider at the root as well as mentioned in the docs.

below is piece of code from my _layout.jsx

const { hasShareIntent, shareIntent } = useShareIntentContext();
  const navigationState = useRootNavigationState();
  // Effect to trigger navigation when t is true
  useEffect(() => {
   
    if (!navigationState?.key) return; // Ensure navigation state is available
    alert(`Testing hasShareIntent: ${hasShareIntent}, ShareText: ${shareIntent.text}`);

    if (hasShareIntent) {
      // Perform navigation to the 'new' page with shared params
      router.replace({
        pathname: "new",
        params: {
          sharedUrl: shareIntent.text || "",
        },
      });
    }
  }, [hasShareIntent, navigationState?.key]); 

- expo version: 51
- using firebase : no
- using static build : no
- routing : expo-router
- platform target : Android
- device : sreal device

sudheersuri avatar Sep 22 '24 20:09 sudheersuri