Files
react-native/Libraries
Tom Targosz a4fbb8e75b Fix ShareSheet crash on iOS 13 (#26429)
Summary:
Currently on iOS 13 the app will crash if you:
- Open the share sheet
- Tap something like messages or photos
- Cancel the dialog
- Perform any other action

This is because `shareController.completionWithItemsHandler` is called when the dialog box is canceled and currently `failureCallback` or `successCallback` will always be called. In the situation above, `activityError` is `nil` so `successCallback` will be called even though `completed` is false. This leaves us in a state where the callback has been invoked but the ShareSheet is still active, meaning the success or error callback will be invoked again, leading to the crash.

This PR adds a check to make sure `completed` is true before calling `successCallback`. This way `successCallback` will only be called when the user has successfully completed an action and the ShareSheet is closed.

## Changelog

[iOS] [Fixed] - Fix crash in RCTActionSheetManager.m on iOS 13
Pull Request resolved: https://github.com/facebook/react-native/pull/26429

Test Plan:
- Saved an image successfully
- Opened and dismissed the `Photos` dialog multiple times without crashing

Differential Revision: D17369712

Pulled By: PeteTheHeat

fbshipit-source-id: 228b696243cd39fad1fa134f4412d95d845b1bc5
2019-09-13 11:33:07 -07:00
..
2019-08-09 10:11:15 -07:00
2019-08-09 10:11:15 -07:00
2019-09-13 07:47:57 -07:00
2019-08-09 10:11:15 -07:00
2019-08-23 08:06:44 -07:00
2019-08-09 10:11:15 -07:00
2019-08-26 23:56:59 -07:00
2019-08-09 10:11:15 -07:00
2019-08-09 10:11:15 -07:00
2019-08-09 10:11:15 -07:00
2019-08-26 23:56:59 -07:00
2019-08-30 18:10:35 -07:00
2019-08-23 08:06:44 -07:00
2019-08-09 10:11:15 -07:00
2019-08-09 10:11:15 -07:00
2019-08-09 10:11:15 -07:00
2019-08-31 10:09:42 -07:00
2019-08-09 10:11:15 -07:00
2019-08-09 10:11:15 -07:00
2019-07-23 03:23:11 -07:00
2019-08-26 23:56:59 -07:00