react-native-share
Advanced tools
Comparing version 9.2.1 to 9.2.2
@@ -19,4 +19,2 @@ "use strict"; | ||
// Concern: I could be wrong but there seems to be an implicit association between url and filename in the native code. | ||
// I don't understand object-c but it looks like we're using urls index to look up a filename. What happens if the length of urls doesn't match the length of filenames? Maybe we can throw an error. | ||
// Reference: https://github.com/react-native-share/react-native-share/pull/1396/files#diff-2d42a82ccc4ec42d9bfea630535ec2b757bd7a90b96d33d5d5433da17f4bdf79R208 | ||
@@ -28,2 +26,3 @@ if (options.filename && !options.filenames) { | ||
} | ||
options.failOnCancel = options.failOnCancel ?? true; | ||
return options; | ||
@@ -30,0 +29,0 @@ } |
@@ -81,4 +81,12 @@ "use strict"; | ||
const result = await _NativeRNShare.default.open(options); | ||
if (!result.success && options.failOnCancel === false) { | ||
throw new Error('User did not share'); | ||
if (!result.success) { | ||
if (options.failOnCancel) { | ||
throw new Error('User did not share'); | ||
} | ||
const dismissedResult = { | ||
dismissedAction: true, | ||
success: result.success, | ||
message: result.message | ||
}; | ||
return dismissedResult; | ||
} | ||
@@ -99,3 +107,2 @@ return result; | ||
const result = { | ||
// Concern: Why do we need to covert success to boolean? A comment would be insightful | ||
success: Boolean(success), | ||
@@ -102,0 +109,0 @@ message |
@@ -12,4 +12,2 @@ import { isIOS } from './platform'; | ||
// Concern: I could be wrong but there seems to be an implicit association between url and filename in the native code. | ||
// I don't understand object-c but it looks like we're using urls index to look up a filename. What happens if the length of urls doesn't match the length of filenames? Maybe we can throw an error. | ||
// Reference: https://github.com/react-native-share/react-native-share/pull/1396/files#diff-2d42a82ccc4ec42d9bfea630535ec2b757bd7a90b96d33d5d5433da17f4bdf79R208 | ||
@@ -21,2 +19,3 @@ if (options.filename && !options.filenames) { | ||
} | ||
options.failOnCancel = options.failOnCancel ?? true; | ||
return options; | ||
@@ -23,0 +22,0 @@ } |
@@ -38,4 +38,12 @@ import NativeRNShare from '../codegenSpec/NativeRNShare'; | ||
const result = await NativeRNShare.open(options); | ||
if (!result.success && options.failOnCancel === false) { | ||
throw new Error('User did not share'); | ||
if (!result.success) { | ||
if (options.failOnCancel) { | ||
throw new Error('User did not share'); | ||
} | ||
const dismissedResult = { | ||
dismissedAction: true, | ||
success: result.success, | ||
message: result.message | ||
}; | ||
return dismissedResult; | ||
} | ||
@@ -56,3 +64,2 @@ return result; | ||
const result = { | ||
// Concern: Why do we need to covert success to boolean? A comment would be insightful | ||
success: Boolean(success), | ||
@@ -59,0 +66,0 @@ message |
{ | ||
"name": "react-native-share", | ||
"description": "Social share, sending simple data to other apps.", | ||
"version": "9.2.1", | ||
"version": "9.2.2", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -11,4 +11,2 @@ import { ShareOptions, ShareSingleOptions } from '../types'; | ||
// Concern: I could be wrong but there seems to be an implicit association between url and filename in the native code. | ||
// I don't understand object-c but it looks like we're using urls index to look up a filename. What happens if the length of urls doesn't match the length of filenames? Maybe we can throw an error. | ||
// Reference: https://github.com/react-native-share/react-native-share/pull/1396/files#diff-2d42a82ccc4ec42d9bfea630535ec2b757bd7a90b96d33d5d5433da17f4bdf79R208 | ||
@@ -21,2 +19,4 @@ if (options.filename && !options.filenames) { | ||
options.failOnCancel = options.failOnCancel ?? true; | ||
return options; | ||
@@ -23,0 +23,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1642
332593