Promise returned by share dialog won't resolve if cancelled on iOS
See original GitHub issueOn 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
- Open share dialog with
Share.share(content, options)
- 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:
- Created 4 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
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 anelse
has resolved my issue.Opened a PR addressing this issue.