continueInApp() only works every other time
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)
@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.

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
@DanC5 were you able to solve it?
@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();
});
}, []);
I see the same issue :|
This is the fix for iOS
https://github.com/meedan/react-native-share-menu/pull/156/commits/373a30d9596796011ff31bbacb1f7f70f59e509c