2015-03-13 22:30:31 +00:00
|
|
|
/**
|
2015-03-23 22:07:33 +00:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
2015-03-13 22:30:31 +00:00
|
|
|
*
|
|
|
|
* @providesModule ActionSheetIOS
|
2015-03-25 02:34:12 +00:00
|
|
|
* @flow
|
2015-03-13 22:30:31 +00:00
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2015-03-18 22:57:49 +00:00
|
|
|
var RCTActionSheetManager = require('NativeModules').ActionSheetManager;
|
2015-03-17 20:42:44 +00:00
|
|
|
|
2015-03-13 22:30:31 +00:00
|
|
|
var invariant = require('invariant');
|
|
|
|
|
|
|
|
var ActionSheetIOS = {
|
2015-03-25 02:34:12 +00:00
|
|
|
showActionSheetWithOptions(options: Object, callback: Function) {
|
2015-03-13 22:30:31 +00:00
|
|
|
invariant(
|
|
|
|
typeof options === 'object' && options !== null,
|
|
|
|
'Options must a valid object'
|
|
|
|
);
|
|
|
|
invariant(
|
|
|
|
typeof callback === 'function',
|
|
|
|
'Must provide a valid callback'
|
|
|
|
);
|
|
|
|
RCTActionSheetManager.showActionSheetWithOptions(
|
|
|
|
options,
|
|
|
|
() => {}, // RKActionSheet compatibility hack
|
|
|
|
callback
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2015-03-25 02:34:12 +00:00
|
|
|
showShareActionSheetWithOptions(
|
|
|
|
options: Object,
|
|
|
|
failureCallback: Function,
|
|
|
|
successCallback: Function
|
|
|
|
) {
|
2015-03-13 22:30:31 +00:00
|
|
|
invariant(
|
|
|
|
typeof options === 'object' && options !== null,
|
|
|
|
'Options must a valid object'
|
|
|
|
);
|
|
|
|
invariant(
|
|
|
|
typeof failureCallback === 'function',
|
|
|
|
'Must provide a valid failureCallback'
|
|
|
|
);
|
|
|
|
invariant(
|
|
|
|
typeof successCallback === 'function',
|
|
|
|
'Must provide a valid successCallback'
|
|
|
|
);
|
|
|
|
RCTActionSheetManager.showShareActionSheetWithOptions(
|
|
|
|
options,
|
|
|
|
failureCallback,
|
|
|
|
successCallback
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = ActionSheetIOS;
|