crn-cli
Version:
The Ctrip React Native CLI Tools
1 lines • 1.12 kB
JavaScript
__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]),s=r(d[4]),u=r(d[5]),l=r(d[6]),h=l.Alert,f=l.Image,k=l.StyleSheet,p=l.Text,S=l.View,y=(function(k){function y(){var n,s;t(this,y);for(var u=arguments.length,f=new Array(u),k=0;k<u;k++)f[k]=arguments[k];return(s=o(this,(n=c(y)).call.apply(n,[this].concat(f)))).state={uri:void 0},s.takeScreenshot=function(){l.takeSnapshot('window',{format:'jpeg',quality:.8}).then(function(t){return s.setState({uri:t})}).catch(function(t){return h.alert(t)})},s}return s(y,k),n(y,[{key:"render",value:function(){return u.createElement(S,null,u.createElement(p,{onPress:this.takeScreenshot,style:v.button},"Click to take a screenshot"),u.createElement(f,{style:v.image,source:{uri:this.state.uri}}))}}]),y})(u.Component),v=k.create({button:{marginBottom:10,fontWeight:'500'},image:{flex:1,height:300,resizeMode:'contain',backgroundColor:'black'}});e.title='Snapshot / Screenshot',e.description='API to capture images from the screen.',e.examples=[{title:'Take screenshot',render:function(){return u.createElement(y,null)}}]},666790,[3,4,5,8,9,11,15]);