Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saveToFiles ignores failOnCancel: false and throws an error [iOS] #1517

Open
Raigen opened this issue Apr 4, 2024 · 1 comment
Open

saveToFiles ignores failOnCancel: false and throws an error [iOS] #1517

Raigen opened this issue Apr 4, 2024 · 1 comment
Labels

Comments

@Raigen
Copy link

Raigen commented Apr 4, 2024

Steps to reproduce

  1. Use the share remote example from the docs to download a file and share it.
  2. Set saveToFiles: true to immediately get a document picker and failOnCancel: false to not fail when the user cancels.
  3. Cancel the file sharing (pressing pack and cancel or swiping the overlay down) => An error appears in the console and the code fails.

Expected behavior

I do not want to get an error when I set failOnCancel: false

Actual behavior

When using saveToFiles: true and failOnCancel: false I still get an [Error: CANCELLED] when I cancel or swipe down the share overlay on iOS.

Environment

  • React Native version: 0.73.4
  • React Native platform + platform version: iOS 17.4
  • Typescript version: 5.2.2

react-native-share

Version: 10.1.0

I have no experience with native code but still looked into the code a bit to at least understand the issue. failOnCancel is handled in the typescript part of the code depending on the result, and the error is a different one if it was active.
The native code for saveToFiles looks like a cancel is not handled at all and the error is originally from here.
https://github.com/react-native-share/react-native-share/blob/main/ios/RNShare.mm#L260-L282

@Raigen Raigen added the bug label Apr 4, 2024
@FirmanDiazSukmawan
Copy link

FirmanDiazSukmawan commented May 26, 2024

i have same problem too but im using share from react-native any solutions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants