UNPKG

crn-cli

Version:

The Ctrip React Native CLI Tools

1 lines 2.09 kB
__d(function(g,r,i,a,m,e,d){'use strict';var t=r(d[0]),s=r(d[1]),n=r(d[2]),l=r(d[3]),o=r(d[4]),h=r(d[5]),u=r(d[6]),c=r(d[7]),p=c.StyleSheet,v=c.View,y=c.Text,b=c.TouchableHighlight,f=c.Share,w=(function(c){function p(s){var h;return t(this,p),(h=n(this,l(p).call(this,s)))._shareMessage=h._shareMessage.bind(o(h)),h._shareText=h._shareText.bind(o(h)),h._showResult=h._showResult.bind(o(h)),h.state={result:''},h}return h(p,c),s(p,[{key:"render",value:function(){return u.createElement(v,null,u.createElement(b,{style:_.wrapper,onPress:this._shareMessage},u.createElement(v,{style:_.button},u.createElement(y,null,"Click to share message"))),u.createElement(b,{style:_.wrapper,onPress:this._shareText},u.createElement(v,{style:_.button},u.createElement(y,null,"Click to share message, URL and title"))),u.createElement(y,null,this.state.result))}},{key:"_shareMessage",value:function(){var t=this;f.share({message:'React Native | A framework for building native apps using React'}).then(this._showResult).catch(function(s){return t.setState({result:'error: '+s.message})})}},{key:"_shareText",value:function(){var t=this;f.share({message:'A framework for building native apps using React',url:'http://facebook.github.io/react-native/',title:'React Native'},{subject:'A subject to go in the email heading',dialogTitle:'Share React Native website',excludedActivityTypes:['com.apple.UIKit.activity.PostToTwitter'],tintColor:'green'}).then(this._showResult).catch(function(s){return t.setState({result:'error: '+s.message})})}},{key:"_showResult",value:function(t){t.action===f.sharedAction?t.activityType?this.setState({result:'shared with an activityType: '+t.activityType}):this.setState({result:'shared'}):t.action===f.dismissedAction&&this.setState({result:'dismissed'})}}]),p})(u.Component),_=p.create({wrapper:{borderRadius:5,marginBottom:5},button:{backgroundColor:'#eeeeee',padding:10}});e.framework='React',e.title='Share',e.description='Share data with other Apps.',e.examples=[{title:'Share Text Content',render:function(){return u.createElement(w,null)}}]},666789,[3,4,5,8,7,9,11,15]);