crn-cli
Version:
The Ctrip React Native CLI Tools
1 lines • 4.43 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]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=c.Image,p=c.LayoutAnimation,y=c.ListView,f=c.StyleSheet,E=c.Text,b=c.TouchableOpacity,x=c.View,w=r(d[7]).UIManager,C=[r(d[8]),r(d[9]),r(d[10]),r(d[11]),r(d[12]),r(d[13]),r(d[14]),r(d[15]),r(d[16]),r(d[17]),r(d[18]),r(d[19])],S=100,I=10,v=(function(c){function y(){var n,l;t(this,y);for(var u=arguments.length,c=new Array(u),h=0;h<u;h++)c[h]=arguments[h];return(l=o(this,(n=s(y)).call.apply(n,[this].concat(c))))._getThumbIdx=function(){return Math.floor(Math.random()*C.length)},l._onPressThumb=function(){var t=T[l.state.thumbIndex%T.length];p.configureNext(t),l.setState({thumbIndex:l._getThumbIdx(),dir:'row'===l.state.dir?'column':'row'})},l.state={thumbIndex:l._getThumbIdx(),dir:'row'},l}return l(y,c),n(y,[{key:"UNSAFE_componentWillMount",value:function(){w.setLayoutAnimationEnabledExperimental&&w.setLayoutAnimationEnabledExperimental(!0)}},{key:"render",value:function(){return u.createElement(b,{onPress:this._onPressThumb,style:[P.buttonContents,{flexDirection:this.state.dir}]},u.createElement(h,{style:P.img,source:C[this.state.thumbIndex]}),u.createElement(h,{style:P.img,source:C[this.state.thumbIndex]}),u.createElement(h,{style:P.img,source:C[this.state.thumbIndex]}),'column'===this.state.dir?u.createElement(E,null,"Oooo, look at this new text! So awesome it may just be crazy. Let me keep typing here so it wraps at least one line."):u.createElement(E,null))}}]),y})(u.Component),H=(function(c){function h(n){var l;t(this,h),(l=o(this,s(h).call(this,n))).renderRow=function(t,n,o){return u.createElement(v,{text:t})},l.renderSectionHeader=function(t,n){return u.createElement(x,{style:P.section},u.createElement(E,{style:P.text},t))},l.renderHeader=function(){var t=l.state.headerPressCount%2?u.createElement(x,null,u.createElement(E,{style:P.text},"1 Like")):null;return u.createElement(b,{onPress:l._onPressHeader,style:P.header},t,u.createElement(x,null,u.createElement(E,{style:P.text},"Table Header (click me)")))},l.renderFooter=function(){return u.createElement(x,{style:P.header},u.createElement(E,{onPress:function(){},style:P.text},"Table Footer"))},l._onPressHeader=function(){var t=T[Math.floor(l.state.headerPressCount/2)%T.length];p.configureNext(t),l.setState({headerPressCount:l.state.headerPressCount+1})};for(var c=new y.DataSource({getRowData:function(t,n,o){return t[o]},getSectionHeaderData:function(t,n){return t[n]},rowHasChanged:function(t,n){return t!==n},sectionHeaderHasChanged:function(t,n){return t!==n}}),f={},w=[],C=[],H=0;H<S;H++){var k='Section '+H;w.push(k),f[k]=k,C[H]=[];for(var A=0;A<I;A++){var D='S'+H+', R'+A;C[H].push(D),f[D]=D}}return l.state={dataSource:c.cloneWithRowsAndSections(f,w,C),headerPressCount:0},l}return l(h,c),n(h,[{key:"render",value:function(){return u.createElement(y,{style:P.listview,dataSource:this.state.dataSource,onChangeVisibleRows:function(t,n){},renderHeader:this.renderHeader,renderFooter:this.renderFooter,renderSectionHeader:this.renderSectionHeader,renderRow:this.renderRow,initialListSize:10,pageSize:4,scrollRenderAheadDistance:500,stickySectionHeadersEnabled:!0})}}]),h})(u.Component),P=f.create({listview:{backgroundColor:'#B0C4DE'},header:{height:40,justifyContent:'center',alignItems:'center',backgroundColor:'#3B5998',flexDirection:'row'},text:{color:'white',paddingHorizontal:8},buttonContents:{flexDirection:'row',justifyContent:'center',alignItems:'center',marginHorizontal:5,marginVertical:3,padding:5,backgroundColor:'#EAEAEA',borderRadius:3,paddingVertical:10},img:{width:64,height:64,marginHorizontal:10,backgroundColor:'transparent'},section:{flexDirection:'column',justifyContent:'center',alignItems:'flex-start',padding:6,backgroundColor:'#5890ff'}}),k={layout:{spring:{duration:750,create:{duration:300,type:p.Types.easeInEaseOut,property:p.Properties.opacity},update:{type:p.Types.spring,springDamping:.4}},easeInEaseOut:{duration:300,create:{type:p.Types.easeInEaseOut,property:p.Properties.scaleXY},update:{delay:100,type:p.Types.easeInEaseOut}}}},T=[k.layout.spring,k.layout.easeInEaseOut];e.title='<ListView> - Paging',e.description='Floating headers & layout animations.',e.examples=[{title:'Simple list view with pagination',render:function(){return u.createElement(H,null)}}]},666716,[3,4,5,8,9,11,15,21,666691,666692,666693,666694,666695,666696,666697,666698,666699,666700,666701,666702]);