Skip to content

Commit

Permalink
Fix Share dialog not resolving promise when dismissed on iOS (#26842)
Browse files Browse the repository at this point in the history
Summary:
On iOS the promised returned by `Share.share(content, options)` isn't resolved if the user dismisses the dialog by either pressing "Cancel" or pressing outside the shared dialog. This PR fixes this issue.

This fixes #26809.

## Changelog

[iOS] [Fixed] - Fix promised returned by `Share.share(content, options)` not resolving if share dialog dismissed
Pull Request resolved: #26842

Test Plan:
1. on iOS, open a share dialog with:

```typescript
const onShare = async () => {
  const result = await Share.share({ message: 'example message' });
}
```

2. Dismiss the opened share dialog and the returned promised should resolve.

Differential Revision: D18189755

Pulled By: cpojer

fbshipit-source-id: 1269932e9549026afefdaa8478ff7d33bbaeb86f
  • Loading branch information
v-fernandez authored and facebook-github-bot committed Oct 28, 2019
1 parent 018b748 commit 7468a6c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion React/CoreModules/RCTActionSheetManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ - (void)presentViewController:(UIViewController *)alertController
shareController.completionWithItemsHandler = ^(NSString *activityType, BOOL completed, __unused NSArray *returnedItems, NSError *activityError) {
if (activityError) {
failureCallback(@[RCTJSErrorFromNSError(activityError)]);
} else if (completed) {
} else if (completed || activityType == nil) {
successCallback(@[@(completed), RCTNullIfNil(activityType)]);
}
};
Expand Down

0 comments on commit 7468a6c

Please sign in to comment.