Skip to content

Commit 7468a6c

Browse files
v-fernandezfacebook-github-bot
authored andcommitted
Fix Share dialog not resolving promise when dismissed on iOS (#26842)
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
1 parent 018b748 commit 7468a6c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

React/CoreModules/RCTActionSheetManager.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ - (void)presentViewController:(UIViewController *)alertController
183183
shareController.completionWithItemsHandler = ^(NSString *activityType, BOOL completed, __unused NSArray *returnedItems, NSError *activityError) {
184184
if (activityError) {
185185
failureCallback(@[RCTJSErrorFromNSError(activityError)]);
186-
} else if (completed) {
186+
} else if (completed || activityType == nil) {
187187
successCallback(@[@(completed), RCTNullIfNil(activityType)]);
188188
}
189189
};

0 commit comments

Comments
 (0)