Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

continueInApp() only works every other time #230

Open
vonstring opened this issue Dec 17, 2022 · 5 comments · May be fixed by #271
Open

continueInApp() only works every other time #230

vonstring opened this issue Dec 17, 2022 · 5 comments · May be fixed by #271

Comments

@vonstring
Copy link

I'm having issues with continueInApp only working every other time. First time it will open the main app as expected. The next time I share something, the share extension just closes as soon as continueInAppis called, and the main app never opens.

I've worked around it by dismissing the extension a while after calling continueInApp:

        ShareMenuReactView.continueInApp();
        setTimeout(() => {
          ShareMenuReactView.dismissExtension();
        }, 500);

which makes the main app open every time. Am I missing something? (very possible)

@DanC5
Copy link

DanC5 commented Jan 13, 2023

@vonstring I've noticed the same thing from my end. I'm seeing the following behavior on iOS (haven't tested Android yet)...

For images, the ShareMenuModuleComponent always loads properly the first time upon clicking my app's icon in the share sheet. However, if I keep my phone's Photos app open and try again, the first time trying to share a second image always fails to bring up the ShareMenuModuleComponent. If I click my app's icon in the share sheet a second time after this first failure, it seems to always work as expected.

The below screenshot is the output from my Metro terminal. The first call to the index.share.js file is unsuccessful (hence there's no log of ShareMenuModuleComponent running) and the second call to index.share.js is successful and all works according to plan. Again, the failures always seem to occur after a successful journey into the app.

Screen Shot 2023-01-13 at 12 50 25 PM

Note that if I close the Photos app and start fresh for a second image, it always seems to work. So the issue is when trying a second time without closing the native Photos app.

The above behavior is the exact same for files in the native iOS Files app. However I've noticed that I can't get audio files from Voicemail to ever succeed the second time. I need to navigate out of Voicemail and then come back in for a second audio file upload to work. Again, first time always works, successive tries (without closing the app) always fail.

@caiosba @Gustash please let us know if there's a better way to utilize your APIs (like dismissExtension referenced above) or if there's a native iOS fix to completely wipe the state clean after the first, successful pass through the share extension flow.

I appreciate the support!

Dan

@jorgegvallejo
Copy link

@DanC5 were you able to solve it?

@DanC5
Copy link

DanC5 commented May 4, 2023

@DanC5 were you able to solve it?

I was not able to solve this, outside of the work around referenced in the original post. A useEffect in my code making the calls looks like this...

useEffect(() => {
    ShareMenuReactView.data()
      .then(({ data }) => {
        const [shareData] = data as unknown as ShareData[];

        if (shareData.data && shareData.mimeType) {
          ShareMenuReactView.continueInApp();
          setTimeout(() => ShareMenuReactView.dismissExtension(), 500);
        }
      })
      .catch(err => {
        console.log(err);
        ShareMenuReactView.dismissExtension();
      });
  }, []);

@GuySerfaty
Copy link

I see the same issue :|

@durdevic
Copy link

durdevic commented Jun 25, 2023

This is the fix for iOS

373a30d

nikvdp added a commit to nikvdp/react-native-share-menu that referenced this issue Jul 16, 2023
@ryanlntn ryanlntn linked a pull request Sep 8, 2023 that will close this issue
nikvdp added a commit to nikvdp/react-native-share-menu that referenced this issue Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants