diff --git a/Examples/UIExplorer/js/ShareExample.js b/Examples/UIExplorer/js/ShareExample.js
new file mode 100644
index 0000000000..4a2f2b84d3
--- /dev/null
+++ b/Examples/UIExplorer/js/ShareExample.js
@@ -0,0 +1,124 @@
+/**
+ * The examples provided by Facebook are for non-commercial testing and
+ * evaluation purposes only.
+ *
+ * Facebook reserves all rights not expressly granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
+ * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * @flow
+ */
+'use strict';
+
+var React = require('react');
+var ReactNative = require('react-native');
+var {
+ StyleSheet,
+ View,
+ Text,
+ TouchableHighlight,
+ Share,
+} = ReactNative;
+
+exports.framework = 'React';
+exports.title = 'Share';
+exports.description = 'Share data with other Apps.';
+exports.examples = [{
+ title: 'Share Text Content',
+ render() {
+ return ;
+ }
+}];
+
+class ShareMessageExample extends React.Component {
+ _shareMessage: Function;
+ _shareText: Function;
+ _showResult: Function;
+ state: any;
+
+ constructor(props) {
+ super(props);
+
+ this._shareMessage = this._shareMessage.bind(this);
+ this._shareText = this._shareText.bind(this);
+ this._showResult = this._showResult.bind(this);
+
+ this.state = {
+ result: ''
+ };
+ }
+
+ render() {
+ return (
+
+
+
+ Click to share message
+
+
+
+
+ Click to share message, URL and title
+
+
+ {this.state.result}
+
+ );
+ }
+
+ _shareMessage() {
+ Share.share({
+ message: 'React Native | A framework for building native apps using React'
+ })
+ .then(this._showResult)
+ .catch((error) => this.setState({result: 'error: ' + error.message}));
+ }
+
+ _shareText() {
+ Share.share({
+ message: 'A framework for building native apps using React',
+ url: 'http://facebook.github.io/react-native/',
+ title: 'React Native'
+ }, {
+ dialogTitle: 'Share React Native website',
+ excludedActivityTypes: [
+ 'com.apple.UIKit.activity.PostToTwitter'
+ ],
+ tintColor: 'green'
+ })
+ .then(this._showResult)
+ .catch((error) => this.setState({result: 'error: ' + error.message}));
+ }
+
+ _showResult(result) {
+ if (result.action === Share.sharedAction) {
+ if (result.activityType) {
+ this.setState({result: 'shared with an activityType: ' + result.activityType});
+ } else {
+ this.setState({result: 'shared'});
+ }
+ } else if (result.action === Share.dismissedAction) {
+ this.setState({result: 'dismissed'});
+ }
+ }
+
+}
+
+
+var styles = StyleSheet.create({
+ wrapper: {
+ borderRadius: 5,
+ marginBottom: 5,
+ },
+ button: {
+ backgroundColor: '#eeeeee',
+ padding: 10,
+ },
+});
diff --git a/Examples/UIExplorer/js/UIExplorerList.android.js b/Examples/UIExplorer/js/UIExplorerList.android.js
index 561408045d..dcd33a82c3 100644
--- a/Examples/UIExplorer/js/UIExplorerList.android.js
+++ b/Examples/UIExplorer/js/UIExplorerList.android.js
@@ -181,6 +181,10 @@ const APIExamples = [
key: 'PointerEventsExample',
module: require('./PointerEventsExample'),
},
+ {
+ key: 'ShareExample',
+ module: require('./ShareExample'),
+ },
{
key: 'TimePickerAndroidExample',
module: require('./TimePickerAndroidExample'),
diff --git a/Examples/UIExplorer/js/UIExplorerList.ios.js b/Examples/UIExplorer/js/UIExplorerList.ios.js
index 81f26bae62..8875f58e77 100644
--- a/Examples/UIExplorer/js/UIExplorerList.ios.js
+++ b/Examples/UIExplorer/js/UIExplorerList.ios.js
@@ -247,6 +247,10 @@ const APIExamples: Array = [
key: 'RCTRootViewIOSExample',
module: require('./RCTRootViewIOSExample'),
},
+ {
+ key: 'ShareExample',
+ module: require('./ShareExample'),
+ },
{
key: 'SnapshotExample',
module: require('./SnapshotExample'),
diff --git a/Libraries/Share/Share.js b/Libraries/Share/Share.js
new file mode 100644
index 0000000000..22839a0796
--- /dev/null
+++ b/Libraries/Share/Share.js
@@ -0,0 +1,116 @@
+/**
+ * Copyright (c) 2016-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.
+ *
+ * @providesModule Share
+ * @flow
+ */
+'use strict';
+
+const Platform = require('Platform');
+const {
+ ActionSheetManager,
+ ShareModule
+} = require('NativeModules');
+const invariant = require('fbjs/lib/invariant');
+const processColor = require('processColor');
+
+type Content = { title?: string, message: string } | { title?: string, url: string };
+type Options = { dialogTitle?: string, excludeActivityTypes?: Array, tintColor?: string };
+
+class Share {
+
+ /**
+ * Open a dialog to share text content.
+ *
+ * In iOS, Returns a Promise which will be invoked an object containing `action`, `activityType`.
+ * If the user dismissed the dialog, the Promise will still be resolved with action being `Share.dismissedAction`
+ * and all the other keys being undefined.
+ *
+ * In Android, Returns a Promise which always be resolved with action being `Share.sharedAction`.
+ *
+ * ### Content
+ *
+ * - `message` - a message to share
+ * - `title` - title of the message
+ *
+ * #### iOS
+ *
+ * - `url` - an URL to share
+ *
+ * At least one of URL and message is required.
+ *
+ * ### Options
+ *
+ * #### iOS
+ *
+ * - `excludedActivityTypes`
+ * - `tintColor`
+ *
+ * #### Android
+ *
+ * - `dialogTitle`
+ *
+ */
+ static share(content: Content, options: Options = {}): Promise