question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Promise returned by share dialog won't resolve if cancelled on iOS

See original GitHub issue

On iOS, the share text dialog won’t resolve the returned promise when the dialog is dismissed by pressing the Cancel button or by pressing outside the dialog. Other share options resolve the promise as expected.

shareLink = async () => {
  await Share.share({ message: 'message-to-share' }) // Hangs if the dialog is dismissed by the Cancel button or by pressing outside the dialog
}

React Native version: 0.61.2

Steps To Reproduce

  1. Open share dialog with Share.share(content, options)
  2. Dismiss the dialog by pressing Cancel or pressing outside the dialog.

Describe what you expected to happen: The promise returned by Share.share(content, options) should be resolved when the dialog is dismissed.

Snack, code example, screenshot, or link to a repository:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
v-fernandezcommented, Nov 7, 2019

@cdunkel I’m not sure when this will be available, but in the meantime, you can use patch-package to make the fix available for you in the version you are using.

1reaction
v-fernandezcommented, Oct 13, 2019

To add more info to this. I believe the bug might be here: https://github.com/facebook/react-native/blob/master/React/CoreModules/RCTActionSheetManager.mm#L183

Changing the else if to an else has resolved my issue.

Opened a PR addressing this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Navigator.share only working once in iOS, second click throws ...
The code seems to be working fine initially, as I can click any of the "Share" buttons and the dialog will appear correctly....
Read more >
iOS 14 Webshare API Broken | Apple Developer Forums
Simple solution for now is to reload page if user tries to share again. Sharing again will reject the second share promise and...
Read more >
Navigator.share() - Web APIs - MDN Web Docs
Return value​​ A Promise that resolves with undefined , or rejected with one of the Exceptions given below.
Read more >
Cancelable Asynchronous Operations with Promises in ...
This function always returns a new Promise which resolves to the return value of the called handler. This is where the crux lies....
Read more >
Getting Started With PromiseKit - RayWenderlich.com
Dec 12 2018, Swift 4.2, iOS 12, Xcode 10 ... Doesn't that look delightful? Promises also let you ... If you then return...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found