crn-cli
Version:
The Ctrip React Native CLI Tools
1 lines • 2.64 kB
JavaScript
__d(function(g,r,i,a,m,e,d){'use strict';var t=r(d[0]),n=r(d[1]),l=r(d[2]),o=r(d[3]),s=r(d[4]),p=r(d[5]),u=r(d[6]),y=u.Alert,c=u.Linking,h=u.Picker,f=u.StyleSheet,A=u.Text,v=u.TouchableHighlight,U=u.View,w={String:String,ArrayBuffer:ArrayBuffer,Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,DataView:DataView},T="\nI am the spirit that negates.\nAnd rightly so, for all that comes to be\nDeserves to perish wretchedly;\n'Twere better nothing would begin.\nThus everything that that your terms, sin,\nDestruction, evil represent\u2014\nThat is my proper element.\n\n--Faust, JW Goethe\n",b=(function(u){function f(){var n,s;t(this,f);for(var p=arguments.length,u=new Array(p),y=0;y<p;y++)u[y]=arguments[y];return(s=l(this,(n=o(f)).call.apply(n,[this].concat(u)))).state={type:'Uint8Array'},s._upload=function(){var t=new XMLHttpRequest;if(t.open('POST','http://posttestserver.com/post.php'),t.onload=function(){return f.handlePostTestServerUpload(t)},t.setRequestHeader('Content-Type','text/plain'),'String'!==s.state.type){for(var n=new ArrayBuffer(256),l=new Uint8Array(n),o=0;o<T.length;o++)l[o]=T.charCodeAt(o);if('ArrayBuffer'!==s.state.type)if('Uint8Array'!==s.state.type){var p=w[s.state.type];t.send(new p(n))}else t.send(l);else t.send(n)}else t.send(T)},s}return s(f,u),n(f,[{key:"render",value:function(){var t=this;return p.createElement(U,null,p.createElement(A,null,"Upload 255 bytes as..."),p.createElement(h,{selectedValue:this.state.type,onValueChange:function(n){return t.setState({type:n})}},Object.keys(w).map(function(t){return p.createElement(h.Item,{key:t,label:t,value:t})})),p.createElement(U,{style:B.uploadButton},p.createElement(v,{onPress:this._upload},p.createElement(U,{style:B.uploadButtonBox},p.createElement(A,{style:B.uploadButtonLabel},"Upload")))))}}],[{key:"handlePostTestServerUpload",value:function(t){if(200===t.status)if(t.responseText){var n=t.responseText.indexOf('http://www.posttestserver.com/');if(-1!==n){var l=t.responseText.slice(n).split('\n')[0];c.openURL(l)}else y.alert('Upload failed','Invalid response payload.')}else y.alert('Upload failed','No response payload.');else y.alert('Upload failed','Expected HTTP 200 OK response, got '+t.status)}}]),f})(p.Component),B=f.create({uploadButton:{marginTop:16},uploadButtonBox:{flex:1,paddingVertical:12,alignItems:'center',backgroundColor:'blue',borderRadius:4},uploadButtonLabel:{color:'white',fontSize:16,fontWeight:'500'}});m.exports=b},666798,[3,4,5,8,9,11,15]);