UNPKG

crn-cli

Version:

The Ctrip React Native CLI Tools

1 lines 3.34 kB
__d(function(g,r,i,a,m,e,d){'use strict';var t=r(d[0]),n=r(d[1]),l=r(d[2]),u=r(d[3]),o=r(d[4]),c=r(d[5]),s=r(d[6]),h=s.SegmentedControlIOS,f=s.Text,v=s.View,E=s.StyleSheet,p=(function(s){function f(){return t(this,f),l(this,u(f).apply(this,arguments))}return o(f,s),n(f,[{key:"render",value:function(){return c.createElement(v,null,c.createElement(v,{style:{marginBottom:10}},c.createElement(h,{values:['One','Two']})),c.createElement(v,null,c.createElement(h,{values:['One','Two','Three','Four','Five']})))}}]),f})(c.Component),y=(function(s){function f(){return t(this,f),l(this,u(f).apply(this,arguments))}return o(f,s),n(f,[{key:"render",value:function(){return c.createElement(v,null,c.createElement(v,null,c.createElement(h,{values:['One','Two'],selectedIndex:0})))}}]),f})(c.Component),C=(function(s){function f(){return t(this,f),l(this,u(f).apply(this,arguments))}return o(f,s),n(f,[{key:"render",value:function(){return c.createElement(v,null,c.createElement(v,null,c.createElement(h,{values:['One','Two'],momentary:!0})))}}]),f})(c.Component),x=(function(s){function f(){return t(this,f),l(this,u(f).apply(this,arguments))}return o(f,s),n(f,[{key:"render",value:function(){return c.createElement(v,null,c.createElement(v,null,c.createElement(h,{enabled:!1,values:['One','Two'],selectedIndex:1})))}}]),f})(c.Component),S=(function(s){function f(){return t(this,f),l(this,u(f).apply(this,arguments))}return o(f,s),n(f,[{key:"render",value:function(){return c.createElement(v,null,c.createElement(v,{style:{marginBottom:10}},c.createElement(h,{tintColor:"#ff0000",values:['One','Two','Three','Four'],selectedIndex:0})),c.createElement(v,null,c.createElement(h,{tintColor:"#00ff00",values:['One','Two','Three'],selectedIndex:1})))}}]),f})(c.Component),I=(function(s){function E(){var n,o;t(this,E);for(var c=arguments.length,s=new Array(c),h=0;h<c;h++)s[h]=arguments[h];return(o=l(this,(n=u(E)).call.apply(n,[this].concat(s)))).state={values:['One','Two','Three'],value:'Not selected',selectedIndex:void 0},o._onChange=function(t){o.setState({selectedIndex:t.nativeEvent.selectedSegmentIndex})},o._onValueChange=function(t){o.setState({value:t})},o}return o(E,s),n(E,[{key:"render",value:function(){return c.createElement(v,null,c.createElement(f,{style:T.text},"Value: ",this.state.value),c.createElement(f,{style:T.text},"Index: ",this.state.selectedIndex),c.createElement(h,{values:this.state.values,selectedIndex:this.state.selectedIndex,onChange:this._onChange,onValueChange:this._onValueChange}))}}]),E})(c.Component),T=E.create({text:{fontSize:14,textAlign:'center',fontWeight:'500',margin:10}});e.title='<SegmentedControlIOS>',e.displayName='SegmentedControlExample',e.description='Native segmented control',e.examples=[{title:'Segmented controls can have values',render:function(){return c.createElement(p,null)}},{title:'Segmented controls can have a pre-selected value',render:function(){return c.createElement(y,null)}},{title:'Segmented controls can be momentary',render:function(){return c.createElement(C,null)}},{title:'Segmented controls can be disabled',render:function(){return c.createElement(x,null)}},{title:'Custom colors can be provided',render:function(){return c.createElement(S,null)}},{title:'Change events can be detected',render:function(){return c.createElement(I,null)}}]},666729,[3,4,5,8,9,11,15]);