UNPKG

crn-cli

Version:

The Ctrip React Native CLI Tools

1 lines 5.79 kB
__d(function(g,r,i,a,m,e,d){'use strict';var t=r(d[0]),n=r(d[1]),o=r(d[2]),c=r(d[3]),h=r(d[4]),l=r(d[5]),u=r(d[6]),s=u.ActionSheetIOS,f=u.StyleSheet,S=u.takeSnapshot,w=u.Text,p=u.View,A=u.Alert,y=['Option 0','Option 1','Option 2','Delete','Cancel'],E=3,v=4,k=(function(u){function f(){var n,h;t(this,f);for(var l=arguments.length,u=new Array(l),S=0;S<l;S++)u[S]=arguments[S];return(h=o(this,(n=c(f)).call.apply(n,[this].concat(u)))).state={clicked:'none'},h.showActionSheet=function(){s.showActionSheetWithOptions({options:y,cancelButtonIndex:v,destructiveButtonIndex:E},function(t){h.setState({clicked:y[t]})})},h}return h(f,u),n(f,[{key:"render",value:function(){return l.createElement(p,null,l.createElement(w,{onPress:this.showActionSheet,style:O.button},"Click to show the ActionSheet"),l.createElement(w,null,"Clicked button: ",this.state.clicked))}}]),f})(l.Component),x=(function(u){function f(){var n,h;t(this,f);for(var l=arguments.length,u=new Array(l),S=0;S<l;S++)u[S]=arguments[S];return(h=o(this,(n=c(f)).call.apply(n,[this].concat(u)))).state={clicked:'none'},h.showActionSheet=function(){s.showActionSheetWithOptions({options:y,cancelButtonIndex:v,destructiveButtonIndex:E,tintColor:'green'},function(t){h.setState({clicked:y[t]})})},h}return h(f,u),n(f,[{key:"render",value:function(){return l.createElement(p,null,l.createElement(w,{onPress:this.showActionSheet,style:O.button},"Click to show the ActionSheet"),l.createElement(w,null,"Clicked button: ",this.state.clicked))}}]),f})(l.Component),b=(function(f){function S(){var n,h;t(this,S);for(var f=arguments.length,w=new Array(f),p=0;p<f;p++)w[p]=arguments[p];return(h=o(this,(n=c(S)).call.apply(n,[this].concat(w)))).state={clicked:'none'},h.anchorRef=l.createRef(),h.showActionSheet=function(){s.showActionSheetWithOptions({options:y,cancelButtonIndex:v,destructiveButtonIndex:E,anchor:h.anchorRef.current?u.findNodeHandle(h.anchorRef.current):void 0},function(t){h.setState({clicked:y[t]})})},h}return h(S,f),n(S,[{key:"render",value:function(){return l.createElement(p,null,l.createElement(p,{style:O.anchorRow},l.createElement(w,{style:O.button},"Click there to show the ActionSheet ->"),l.createElement(w,{onPress:this.showActionSheet,style:O.button,ref:this.anchorRef},"HERE")),l.createElement(w,null,"Clicked button: ",this.state.clicked))}}]),S})(l.Component),C=(function(u){function f(){var n,h;t(this,f);for(var l=arguments.length,u=new Array(l),S=0;S<l;S++)u[S]=arguments[S];return(h=o(this,(n=c(f)).call.apply(n,[this].concat(u)))).state={text:''},h.showShareActionSheet=function(){s.showShareActionSheetWithOptions({url:h.props.url,message:'message to go with the shared url',subject:'a subject to go in the email heading',excludedActivityTypes:['com.apple.UIKit.activity.PostToTwitter']},function(t){return A.alert('Error',t)},function(t,n){var o;o=t?"Shared via "+n:"You didn't share",h.setState({text:o})})},h}return h(f,u),n(f,[{key:"render",value:function(){return l.createElement(p,null,l.createElement(w,{onPress:this.showShareActionSheet,style:O.button},"Click to show the Share ActionSheet"),l.createElement(w,null,this.state.text))}}]),f})(l.Component),R=(function(u){function f(){var n,h;t(this,f);for(var l=arguments.length,u=new Array(l),w=0;w<l;w++)u[w]=arguments[w];return(h=o(this,(n=c(f)).call.apply(n,[this].concat(u)))).state={text:''},h.showShareActionSheet=function(){S('window').then(function(t){s.showShareActionSheetWithOptions({url:t,excludedActivityTypes:['com.apple.UIKit.activity.PostToTwitter']},function(t){return A.alert('Error',t)},function(t,n){var o;o=t?"Shared via "+n:"You didn't share",h.setState({text:o})})}).catch(function(t){return A.alert('Error',t)})},h}return h(f,u),n(f,[{key:"render",value:function(){return l.createElement(p,null,l.createElement(w,{onPress:this.showShareActionSheet,style:O.button},"Click to show the Share ActionSheet"),l.createElement(w,null,this.state.text))}}]),f})(l.Component),I=(function(f){function y(){var n,h;t(this,y);for(var f=arguments.length,w=new Array(f),p=0;p<f;p++)w[p]=arguments[p];return(h=o(this,(n=c(y)).call.apply(n,[this].concat(w)))).state={text:''},h.anchorRef=l.createRef(),h.showShareActionSheet=function(){S('window').then(function(t){s.showShareActionSheetWithOptions({url:t,excludedActivityTypes:['com.apple.UIKit.activity.PostToTwitter'],anchor:h.anchorRef.current?u.findNodeHandle(h.anchorRef.current):void 0},function(t){return A.alert('Error',t)},function(t,n){var o;o=t?"Shared via "+n:"You didn't share",h.setState({text:o})})}).catch(function(t){return A.alert('Error',t)})},h}return h(y,f),n(y,[{key:"render",value:function(){return l.createElement(p,null,l.createElement(p,{style:O.anchorRow},l.createElement(w,{style:O.button},"Click to show the Share ActionSheet ->"),l.createElement(w,{onPress:this.showShareActionSheet,style:O.button,ref:this.anchorRef},"HERE")),l.createElement(w,null,this.state.text))}}]),y})(l.Component),O=f.create({button:{marginBottom:10,fontWeight:'500'},anchorRow:{flex:1,flexDirection:'row',justifyContent:'space-between'}});e.title='ActionSheetIOS',e.description="Interface to show iOS' action sheets",e.examples=[{title:'Show Action Sheet',render:function(){return l.createElement(k,null)}},{title:'Show Action Sheet with tinted buttons',render:function(){return l.createElement(x,null)}},{title:'Show Action Sheet with anchor',render:function(){return l.createElement(b,null)}},{title:'Show Share Action Sheet',render:function(){return l.createElement(C,{url:"https://code.facebook.com"})}},{title:'Share Local Image',render:function(){return l.createElement(C,{url:"bunny.png"})}},{title:'Share Screenshot',render:function(){return l.createElement(R,null)}},{title:'Share from Anchor',render:function(){return l.createElement(I,null)}}]},666749,[3,4,5,8,9,11,15]);