Clarify ActionSheetIOSExample.js

Summary:
The `successCallback` passed via `static showShareActionSheetWithOptions(options, failureCallback, successCallback)` has two parameters (see [native code](e1577df1fd/Libraries/ActionSheetIOS/RCTActionSheetManager.m (L174))), and the name used for the first parameter in the JS example is confusing. This fixes that.

The first parameter is a boolean indicating whether the user completed the sharing (when TRUE) or cancelled it (when FALSE). Instead of calling it "success" in the example, I propose using `completed`, which is more in line with what you see in the native code.

Otherwise, we have a "successCallback" function whose first parameter tells us if we were "successful", and that's confusing (indeed, I think it already caused some confusion in the [react-native-share](https://github.com/EstebanFuentealba/react-native-share/) module: see [this issue](https://github.com/EstebanFuentealba/react-native-share/issues/48)).
Closes https://github.com/facebook/react-native/pull/11914

Differential Revision: D4490039

Pulled By: mkonicek

fbshipit-source-id: 5d7f01eae760e3fb271e7fa080c2f0147c53418a
This commit is contained in:
Peter W 2017-01-31 13:23:25 -08:00 committed by Facebook Github Bot
parent 28ea2d6261
commit 1beb6274b8
1 changed files with 4 additions and 4 deletions

View File

@ -131,9 +131,9 @@ class ShareActionSheetExample extends React.Component {
]
},
(error) => alert(error),
(success, method) => {
(completed, method) => {
var text;
if (success) {
if (completed) {
text = `Shared via ${method}`;
} else {
text = 'You didn\'t share';
@ -172,9 +172,9 @@ class ShareScreenshotExample extends React.Component {
]
},
(error) => alert(error),
(success, method) => {
(completed, method) => {
var text;
if (success) {
if (completed) {
text = `Shared via ${method}`;
} else {
text = 'You didn\'t share';