UNPKG

crn-cli

Version:

The Ctrip React Native CLI Tools

1 lines 2.81 kB
__d(function(g,r,i,a,m,e,d){'use strict';var t=r(d[0]),n=r(d[1]),c=r(d[2]),l=r(d[3]),s=r(d[4]),o=r(d[5]),u=r(d[6]),h=u.CheckBox,x=u.Text,C=u.View,k=u.StyleSheet,f=(function(u){function x(){var n,s;t(this,x);for(var o=arguments.length,u=new Array(o),h=0;h<o;h++)u[h]=arguments[h];return(s=c(this,(n=l(x)).call.apply(n,[this].concat(u)))).state={trueCheckBoxIsOn:!0,falseCheckBoxIsOn:!1},s}return s(x,u),n(x,[{key:"render",value:function(){var t=this;return o.createElement(C,null,o.createElement(h,{onValueChange:function(n){return t.setState({falseCheckBoxIsOn:n})},style:O.checkbox,value:this.state.falseCheckBoxIsOn}),o.createElement(h,{onValueChange:function(n){return t.setState({trueCheckBoxIsOn:n})},value:this.state.trueCheckBoxIsOn}))}}]),x})(o.Component),v=(function(u){function x(){return t(this,x),c(this,l(x).apply(this,arguments))}return s(x,u),n(x,[{key:"render",value:function(){return o.createElement(C,null,o.createElement(h,{disabled:!0,style:O.checkbox,value:!0}),o.createElement(h,{disabled:!0,value:!1}))}}]),x})(o.Component),B=(function(u){function k(){var n,s;t(this,k);for(var o=arguments.length,u=new Array(o),h=0;h<o;h++)u[h]=arguments[h];return(s=c(this,(n=l(k)).call.apply(n,[this].concat(u)))).state={eventCheckBoxIsOn:!1,eventCheckBoxRegressionIsOn:!0},s}return s(k,u),n(k,[{key:"render",value:function(){var t=this;return o.createElement(C,{style:O.container},o.createElement(C,null,o.createElement(h,{onValueChange:function(n){return t.setState({eventCheckBoxIsOn:n})},style:O.checkbox,value:this.state.eventCheckBoxIsOn}),o.createElement(h,{onValueChange:function(n){return t.setState({eventCheckBoxIsOn:n})},style:O.checkbox,value:this.state.eventCheckBoxIsOn}),o.createElement(x,null,this.state.eventCheckBoxIsOn?'On':'Off')),o.createElement(C,null,o.createElement(h,{onValueChange:function(n){return t.setState({eventCheckBoxRegressionIsOn:n})},style:O.checkbox,value:this.state.eventCheckBoxRegressionIsOn}),o.createElement(h,{onValueChange:function(n){return t.setState({eventCheckBoxRegressionIsOn:n})},style:O.checkbox,value:this.state.eventCheckBoxRegressionIsOn}),o.createElement(x,null,this.state.eventCheckBoxRegressionIsOn?'On':'Off')))}}]),k})(o.Component),O=k.create({container:{flexDirection:'row',justifyContent:'space-around'},checkbox:{marginBottom:10}});e.title='<CheckBox>',e.displayName='CheckBoxExample',e.description='Native boolean input',e.examples=[{title:'CheckBoxes can be set to true or false',render:function(){return o.createElement(f,null)}},{title:'CheckBoxes can be disabled',render:function(){return o.createElement(v,null)}},{title:'Change events can be detected',render:function(){return o.createElement(B,null)}},{title:'CheckBoxes are controlled components',render:function(){return o.createElement(h,null)}}]},666819,[3,4,5,8,9,11,15]);