From 75bcdbdcebebc65b98dc19aaf2f085b99cab0529 Mon Sep 17 00:00:00 2001 From: luomy Date: Thu, 18 Nov 2021 10:25:25 +0800 Subject: [PATCH] feat(ios): optimize scale factor and demo --- .../src/components/ListView/index.jsx | 2 +- examples/ios-demo/res/index.ios.js | 4 +-- ios/sdk/component/view/HippyShadowView.mm | 2 +- ios/sdk/layout/MTTLayout.cpp | 4 +++ ios/sdk/layout/MTTLayout.h | 1 + ios/sdk/layout/MTTNode.cpp | 28 +++++++++++++------ ios/sdk/layout/MTTNode.h | 10 ++++++- ios/sdk/layout/MTTUtil.cpp | 24 +++++++++------- ios/sdk/layout/MTTUtil.h | 2 +- 9 files changed, 52 insertions(+), 25 deletions(-) diff --git a/examples/hippy-react-demo/src/components/ListView/index.jsx b/examples/hippy-react-demo/src/components/ListView/index.jsx index 38893a2e924..5a8420f5b38 100644 --- a/examples/hippy-react-demo/src/components/ListView/index.jsx +++ b/examples/hippy-react-demo/src/components/ListView/index.jsx @@ -52,7 +52,7 @@ const styles = StyleSheet.create({ separatorLine: { marginLeft: 12, marginRight: 12, - height: 0.5, + height: 1, backgroundColor: '#e5e5e5', }, loading: { diff --git a/examples/ios-demo/res/index.ios.js b/examples/ios-demo/res/index.ios.js index c7da94d57bb..b292b5f27f2 100644 --- a/examples/ios-demo/res/index.ios.js +++ b/examples/ios-demo/res/index.ios.js @@ -1,4 +1,4 @@ -!function(e){function t(t){for(var n,o,a=t[0],i=t[1],l=0,s=[];l0===i.indexOf(e))){var l=i.split("/"),c=l[l.length-1],s=c.split(".")[0];(u=global.__DYNAMIC_LOAD_MAP__[s])&&(i=u+c)}else{var u;s=i.split(".")[0];(u=global.__DYNAMIC_LOAD_MAP__[s])&&(i=u+i)}onScriptComplete=function(t){t&&(t.name="ChunkLoadError",chunk[1](t),r[e]=void 0)},global.dynamicLoad(i,onScriptComplete)}return Promise.all(t)},o.m=e,o.c=n,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o.oe=function(e){throw console.error(e),e};var a=(0,eval)("this").webpackJsonp=(0,eval)("this").webpackJsonp||[],i=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;le.length)&&(t=e.length);for(var n=0,r=new Array(t);n0===l.indexOf(e))){var c=l.split("/"),s=c[c.length-1],u=s.split(".")[0];(f=global.__DYNAMIC_LOAD_CUSTOM_PATH_MAP__[u])&&(l=f+s)}else{var f;u=l.split(".")[0];(f=global.__DYNAMIC_LOAD_CUSTOM_PATH_MAP__[u])&&(l=f+l)}onScriptComplete=function(t){if(t instanceof Error){t.message+=", load chunk "+e+" failed, path is "+l;var n=r[e];0!==n&&n&&n[1](t),r[e]=void 0}},global.dynamicLoad(l,onScriptComplete)}return Promise.all(t)},o.m=e,o.c=n,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o.oe=function(e){throw console.error(e),e};var a=(0,eval)("this").webpackJsonp=(0,eval)("this").webpackJsonp||[],i=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;le.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}("object"===t(e)?e.exports:{});try{regeneratorRuntime=r}catch(e){"object"===("undefined"==typeof globalThis?"undefined":t(globalThis))?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}).call(this,n("./node_modules/webpack/buildin/module.js")(e))},"./node_modules/webpack/buildin/global.js":function(e,t,n){e.exports=n("dll-reference hippyReactBase")("./node_modules/webpack/buildin/global.js")},"./node_modules/webpack/buildin/module.js":function(e,t,n){e.exports=n("dll-reference hippyReactBase")("./node_modules/webpack/buildin/module.js")},"./src/main.js":function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"Focusable",(function(){return ee})),n.d(r,"Image",(function(){return oe})),n.d(r,"ListView",(function(){return ge})),n.d(r,"Modal",(function(){return Ee})),n.d(r,"RefreshWrapper",(function(){return qe})),n.d(r,"PullHeader",(function(){return Qe})),n.d(r,"ScrollView",(function(){return Je})),n.d(r,"Text",(function(){return et})),n.d(r,"TextInput",(function(){return rt})),n.d(r,"View",(function(){return it})),n.d(r,"ViewPager",(function(){return gt})),n.d(r,"WebView",(function(){return vt})),n.d(r,"BoxShadow",(function(){return St})),n.d(r,"WaterfallView",(function(){return Rt}));var o={};n.r(o),n.d(o,"Animation",(function(){return It})),n.d(o,"AsyncStorage",(function(){return Pt})),n.d(o,"Clipboard",(function(){return Bt})),n.d(o,"NativeEvent",(function(){return Ft})),n.d(o,"NetInfo",(function(){return Nt})),n.d(o,"TestModule",(function(){return Ut})),n.d(o,"WebSocket",(function(){return $t})),n.d(o,"UIManagerModule",(function(){return on}));var a={};n.r(a),n.d(a,"MyView",(function(){return fn})),n.d(a,"Slider",(function(){return bn})),n.d(a,"TabHost",(function(){return xn})),n.d(a,"SetNativeProps",(function(){return Cn})),n.d(a,"DynamicImport",(function(){return An})),n.d(a,"Localization",(function(){return In})),n.d(a,"Turbo",(function(){return _n}));var i=n("../../packages/hippy-react/dist/index.js"),l=n("./node_modules/@babel/runtime/helpers/classCallCheck.js"),c=n.n(l),s=n("./node_modules/@babel/runtime/helpers/createClass.js"),u=n.n(s),f=n("./node_modules/@babel/runtime/helpers/inherits.js"),h=n.n(f),d=n("./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"),m=n.n(d),p=n("./node_modules/@babel/runtime/helpers/getPrototypeOf.js"),y=n.n(p),g=n("./node_modules/react/index.js"),b=n.n(g),v=n("./node_modules/@babel/runtime/helpers/toConsumableArray.js"),w=n.n(v),x=n("./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js");n("./node_modules/prop-types/index.js"),n("./node_modules/@babel/runtime/helpers/typeof.js");function S(){return(S=Object.assign||function(e){for(var t=1;t=0;u--){var f=o[u];"."===f?T(o,u):".."===f?(T(o,u),s++):s&&(T(o,u),s--)}if(!l)for(;s--;s)o.unshift("..");!l||""===o[0]||o[0]&&E(o[0])||o.unshift("");var h=o.join("/");return n&&"/"!==h.substr(-1)&&(h+="/"),h};var R=function(e,t){if(!e)throw new Error("Invariant failed")};function k(e){var t=e.pathname,n=e.search,r=e.hash,o=t||"/";return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}function A(e,t,n,r){var o;"string"==typeof e?(o=function(e){var t=e||"/",n="",r="",o=t.indexOf("#");-1!==o&&(r=t.substr(o),t=t.substr(0,o));var a=t.indexOf("?");return-1!==a&&(n=t.substr(a),t=t.substr(0,a)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e)).state=t:(void 0===(o=S({},e)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==t&&void 0===o.state&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(e){throw e instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):e}return n&&(o.key=n),r?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=C(o.pathname,r.pathname)):o.pathname=r.pathname:o.pathname||(o.pathname="/"),o}function V(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,o){if(null!=e){var a="function"==typeof e?e(t,n):e;"string"==typeof a?"function"==typeof r?r(a,o):o(!0):o(!1!==a)}else o(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;rt?n.splice(t,n.length-t,r):n.push(r),u({action:"PUSH",location:r,index:t,entries:n})}}))},replace:function(e,t){var r=A(e,t,f(),y.location);s.confirmTransitionTo(r,"REPLACE",n,(function(e){e&&(y.entries[y.index]=r,u({action:"REPLACE",location:r}))}))},go:p,goBack:function(){p(-1)},goForward:function(){p(1)},canGo:function(e){var t=y.index+e;return t>=0&&t=0||(o[n]=e[n]);return o}var L=n("./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js"),B=n.n(L),M=function(e){var t=Object(O.a)();return t.displayName=e,t}("Router"),z=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={location:t.history.location},n._isMounted=!1,n._pendingLocation=null,t.staticContext||(n.unlisten=t.history.listen((function(e){n._isMounted?n.setState({location:e}):n._pendingLocation=e}))),n}Object(x.a)(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var n=t.prototype;return n.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},n.componentWillUnmount=function(){this.unlisten&&this.unlisten()},n.render=function(){return b.a.createElement(M.Provider,{children:this.props.children||null,value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}})},t}(b.a.Component);var F=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o=100?t([]):t(he)}),1e3)}))}},{key:"render",value:function(){var e=this,t=this.state.dataSource;return b.a.createElement(i.ListView,{bounces:!0,overScrollEnabled:!0,horizontal:void 0,style:{flex:1,backgroundColor:"#ffffff"},numberOfRows:t.length,renderRow:this.getRenderRow,onEndReached:this.onEndReached,getRowType:this.getRowType,onDelete:this.onDelete,delText:this.delText,editable:!0,getRowKey:this.getRowKey,initialListSize:15,rowShouldSticky:function(e){return 2===e},onAppear:function(t){return e.onAppear(t)},onDisappear:function(t){return e.onDisappear(t)},onWillAppear:function(t){return e.onWillAppear(t)},onWillDisappear:function(t){return e.onWillDisappear(t)}})}}]),r}(b.a.Component);function be(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var ve="#4c9afa",we="#f44837",xe="#fff",Se=i.StyleSheet.create({container:{flex:1,flexDirection:"row",justifyContent:"center"},buttonView:{borderColor:ve,borderWidth:2,borderRadius:8,justifyContent:"center",alignItems:"center",width:250,height:50,marginTop:30},buttonText:{fontSize:20,color:ve,textAlign:"center",textAlignVertical:"center"}}),Ee=function(e){h()(n,e);var t=be(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={visible:!1,press:!1},r.show=r.show.bind(ce()(r)),r.hide=r.hide.bind(ce()(r)),r}return u()(n,[{key:"feedback",value:function(e){this.setState({press:"in"===e})}},{key:"show",value:function(){this.setState({visible:!0})}},{key:"hide",value:function(){this.setState({visible:!1})}},{key:"render",value:function(){var e=this,t=this.state,n=t.press,r=t.visible;return b.a.createElement(i.ScrollView,null,b.a.createElement(i.View,{style:Se.container},b.a.createElement(i.View,{onPressIn:function(){return e.feedback("in")},onPressOut:function(){return e.feedback.bind("out")},onClick:this.show,style:[Se.buttonView,{borderColor:ve,opacity:n?.5:1}]},b.a.createElement(i.Text,{style:[Se.buttonText,{color:ve}]},"点击弹出浮层"))),b.a.createElement(i.Modal,{transparent:!0,animationType:"slide_fade",visible:r,onRequestClose:function(){},supportedOrientations:["portrait"]},b.a.createElement(i.View,{style:{flex:1,flexDirection:"row",justifyContent:"center"}},b.a.createElement(i.View,{onClick:this.hide,style:{width:200,height:200,backgroundColor:we,marginTop:300,flexDirection:"row",justifyContent:"center"}},b.a.createElement(i.Text,{style:{color:xe,fontSize:22,marginTop:80}},"点击关闭浮层")))))}}]),n}(b.a.Component),Te="http://res.imtt.qq.com/tps/expo-listview-1.jpg",Ce={style:1,itemBean:{title:"非洲总统出行真大牌,美制武装直升机和中国潜艇为其保驾",picList:[Te,Te,Te],subInfo:["三图评论","11评"]}},Re={style:2,itemBean:{title:"彼得·泰尔:认知未来是投资人的谋生之道",picUrl:"http://res.imtt.qq.com/tps/expo-listview-2.jpg",subInfo:["左文右图"]}},ke={style:5,itemBean:{title:"愤怒!美官员扬言:“不让中国拿走南海的岛屿,南海岛礁不属于中国”?",picUrl:"http://res.imtt.qq.com/tps/expo-listview-3.jpg",subInfo:["六眼神魔 5234播放"]}},Ae=[ke,Ce,Re,Ce,Re,Ce,Re,ke,Ce],Ve={getScreenWidth:function(){var e=i.Dimensions.get("screen").width,t=i.Dimensions.get("screen").height,n=e>t?t:e;return Math.floor(n)},uniqueArray:function(e){for(var t=[],n=0;n=812&&i.PixelRatio.get()>=2&&(e=!0),e}},je=(Ve.getScreenWidth()-24-12)/3,Ie=Math.floor(je/1.35),Oe=i.StyleSheet.create({imageContainer:{flexDirection:"row",justifyContent:"center",height:Ie,marginTop:8},normalText:{fontSize:11,color:"#aaaaaa",alignSelf:"center"},image:{width:je,height:Ie},title:{fontSize:"android"===i.Platform.OS?17:18,lineHeight:24,color:"#242424"},tagLine:{marginTop:8,height:20,flexDirection:"row",justifyContent:"flex-start"}});function De(e){var t=e.itemBean,n=t.title,r=t.picList,o=e.itemBean.subInfo,a=null;if(o&&o.length){var l=(o=Ve.uniqueArray(o)).join(" ");a=b.a.createElement(i.Text,{style:Oe.normalText,numberOfLines:1},l)}return b.a.createElement(i.View,e,b.a.createElement(i.Text,{style:[Oe.title],numberOfLines:2,enableScale:!0},n),b.a.createElement(i.View,{style:Oe.imageContainer},b.a.createElement(i.Image,{style:Oe.image,source:{uri:r[0]},resizeMode:i.Image.resizeMode.cover}),b.a.createElement(i.Image,{style:[Oe.image,{marginLeft:6,marginRight:6}],source:{uri:r[1]},resizeMode:i.Image.resizeMode.cover}),b.a.createElement(i.Image,{style:Oe.image,source:{uri:r[2]},resizeMode:i.Image.resizeMode.cover})),a?b.a.createElement(i.View,{style:Oe.tagLine},a):null)}var Pe=Ve.getScreenWidth()-24,_e=Math.floor(Pe-12)/3,Le=Math.floor(_e/1.35),Be=i.StyleSheet.create({container:{flexDirection:"row",justifyContent:"space-between",height:Le},leftContainer:{flex:1,flexDirection:"column",justifyContent:"center",marginRight:8},imageContainer:{width:_e,height:Le},image:{width:_e,height:Le},title:{fontSize:"android"===i.Platform.OS?17:18,lineHeight:24},tagLine:{marginTop:8,height:20,flexDirection:"row",justifyContent:"flex-start"},normalText:{fontSize:11,color:"#aaaaaa",alignSelf:"center"}});function Me(e){if("undefined"===e)return null;var t=e.itemBean;if(!t)return null;var n=null,r=t.title,o=t.picUrl,a=t.subInfo;if(a&&a.length){var l=(a=Ve.uniqueArray(a)).join(" ");n=b.a.createElement(i.Text,{style:Be.normalText,numberOfLines:1},l)}return b.a.createElement(i.View,{style:Be.container},b.a.createElement(i.View,{style:Be.leftContainer},b.a.createElement(i.Text,{style:Be.title,numberOfLines:2,enableScale:!0},r),n?b.a.createElement(i.View,{style:Be.tagLine},n):null),b.a.createElement(i.View,{style:Be.imageContainer},b.a.createElement(i.Image,{resizeMode:i.Image.resizeMode.cover,style:Be.image,source:{uri:o}})))}var ze=Ve.getScreenWidth()-24,Fe=Math.floor(188*ze/336),We=i.StyleSheet.create({text:{fontSize:"android"===i.Platform.OS?17:18,lineHeight:24,color:"#242424"},playerView:{marginTop:8,alignItems:"center",width:ze,height:Fe,alignSelf:"center"},image:{width:ze,height:Fe},normalText:{fontSize:11,color:"#aaaaaa",alignSelf:"center"},tagLine:{marginTop:8,flexDirection:"row",justifyContent:"space-between",alignItems:"center"}});function He(e){if("undefined"===e)return null;var t=e.itemBean;if(!t)return null;var n=t.title,r=t.picUrl,o=t.subInfo,a=null;if(o&&o.length){var l=(o=Ve.uniqueArray(o)).join(" ");a=b.a.createElement(i.Text,{style:We.normalText,numberOfLines:1},l)}return b.a.createElement(i.View,null,b.a.createElement(i.Text,{style:We.text,numberOfLines:2,enableScale:!0},n),b.a.createElement(i.View,{style:We.playerView},b.a.createElement(i.Image,{style:We.image,source:{uri:r},resizeMode:i.Image.resizeMode.cover})),a?b.a.createElement(i.View,{style:We.tagLine},a):null)}function Ne(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Ke=i.StyleSheet.create({container:{backgroundColor:"#ffffff"},itemContainer:{padding:12},spliter:{marginLeft:12,marginRight:12,height:.5,backgroundColor:"#e5e5e5"},loading:{fontSize:11,color:"#aaaaaa",alignSelf:"center"}}),qe=function(e){h()(o,e);var t,n,r=Ne(o);function o(e){var t;return c()(this,o),(t=r.call(this,e)).state={dataSource:[],loadingState:"正在加载..."},t.fetchTimes=0,t.mockFetchData=t.mockFetchData.bind(ce()(t)),t.onRefresh=t.onRefresh.bind(ce()(t)),t.getRefresh=t.getRefresh.bind(ce()(t)),t.getRenderRow=t.getRenderRow.bind(ce()(t)),t.onEndReached=t.onEndReached.bind(ce()(t)),t.getRowType=t.getRowType.bind(ce()(t)),t.getRowKey=t.getRowKey.bind(ce()(t)),t}return u()(o,[{key:"componentDidMount",value:(n=ie()(ue.a.mark((function e(){var t;return ue.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.mockFetchData();case 2:t=e.sent,this.setState({dataSource:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"onEndReached",value:(t=ie()(ue.a.mark((function e(){var t,n,r,o,a;return ue.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.state,n=t.dataSource,!t.fetchingDataFlag){e.next=3;break}return e.abrupt("return");case 3:return this.setState({fetchingDataFlag:!0,dataSource:n.concat([{style:100}])}),e.next=6,this.mockFetchData();case 6:r=e.sent,(o=n[n.length-1])&&100===o.style&&n.pop(),a=n.concat(r),this.setState({dataSource:a});case 11:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"onRefresh",value:function(){var e=this;setTimeout(ie()(ue.a.mark((function t(){var n;return ue.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.mockFetchData();case 2:n=t.sent,e.setState({dataSource:n}),e.refresh.refreshComplected();case 5:case"end":return t.stop()}}),t)}))),1e3)}},{key:"onClickItem",value:function(e){console.log("item: ".concat(e," is clicked.."))}},{key:"getRenderRow",value:function(e){var t=this,n=this.state,r=n.dataSource,o=n.loadingState,a=null,l=r[e],c=r.length===e+1;switch(l.style){case 1:a=b.a.createElement(De,{itemBean:l.itemBean,onClick:function(){return t.onClickItem(e)}});break;case 2:a=b.a.createElement(Me,{itemBean:l.itemBean,onClick:function(){return t.onClickItem(e)}});break;case 5:a=b.a.createElement(He,{itemBean:l.itemBean,onClick:function(){return t.onClickItem(e)}});break;case 100:a=b.a.createElement(i.Text,{style:Ke.loading},o)}return b.a.createElement(i.View,{style:Ke.container},b.a.createElement(i.View,{style:Ke.itemContainer},a),c?null:b.a.createElement(i.View,{style:Ke.spliter}))}},{key:"getRowType",value:function(e){return this.state.dataSource[e].style}},{key:"getRowKey",value:function(e){return"row-".concat(e)}},{key:"getRefresh",value:function(){return b.a.createElement(i.View,{style:{flex:1,height:30}},b.a.createElement(i.Text,{style:{flex:1,textAlign:"center"}},"下拉刷新中..."))}},{key:"mockFetchData",value:function(){var e=this;return new Promise((function(t){setTimeout((function(){return e.setState({fetchingDataFlag:!1}),e.fetchTimes+=1,e.fetchTimes>=50?t([]):t(Ae)}),1e3)}))}},{key:"render",value:function(){var e=this,t=this.state.dataSource;return b.a.createElement(i.RefreshWrapper,{ref:function(t){e.refresh=t},style:{flex:1},onRefresh:this.onRefresh,bounceTime:100,getRefresh:this.getRefresh},b.a.createElement(i.ListView,{style:{flex:1,backgroundColor:"#ffffff"},numberOfRows:t.length,renderRow:this.getRenderRow,onEndReached:this.onEndReached,getRowType:this.getRowType,getRowKey:this.getRowKey}))}}]),o}(b.a.Component);function Ge(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Ue=i.StyleSheet.create({container:{backgroundColor:"#ffffff"},itemContainer:{padding:12},splitter:{marginLeft:12,marginRight:12,height:.5,backgroundColor:"#e5e5e5"},loading:{fontSize:11,color:"#aaaaaa",alignSelf:"center"},pullContainer:{height:60,backgroundColor:"green"},pullContent:{lineHeight:60,color:"white",height:60,textAlign:"center"}}),Qe=function(e){h()(a,e);var t,n,r,o=Ge(a);function a(e){var t;return c()(this,a),(t=o.call(this,e)).state={dataSource:[],pullingText:"继续下拉触发刷新",loadingState:"正在加载..."},t.fetchTimes=0,t.mockFetchData=t.mockFetchData.bind(ce()(t)),t.renderRow=t.renderRow.bind(ce()(t)),t.getRowType=t.getRowType.bind(ce()(t)),t.getRowKey=t.getRowKey.bind(ce()(t)),t.renderPullHeader=t.renderPullHeader.bind(ce()(t)),t.onEndReached=t.onEndReached.bind(ce()(t)),t.onHeaderReleased=t.onHeaderReleased.bind(ce()(t)),t.onHeaderPulling=t.onHeaderPulling.bind(ce()(t)),t}return u()(a,[{key:"componentDidMount",value:(r=ie()(ue.a.mark((function e(){var t;return ue.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.mockFetchData();case 2:t=e.sent,this.setState({dataSource:t}),this.listView.collapsePullHeader();case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"onEndReached",value:(n=ie()(ue.a.mark((function e(){var t,n,r,o;return ue.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.state.dataSource,!this.loadMoreDataFlag){e.next=3;break}return e.abrupt("return");case 3:return this.loadMoreDataFlag=!0,this.setState({dataSource:t.concat([{style:100}])}),n=[],e.prev=6,e.next=9,this.mockFetchData();case 9:n=e.sent,e.next=14;break;case 12:e.prev=12,e.t0=e.catch(6);case 14:(r=t[t.length-1])&&100===r.style&&t.pop(),o=t.concat(n),this.loadMoreDataFlag=!1,this.setState({dataSource:o});case 19:case"end":return e.stop()}}),e,this,[[6,12]])}))),function(){return n.apply(this,arguments)})},{key:"onHeaderReleased",value:(t=ie()(ue.a.mark((function e(){var t,n=this;return ue.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.fetchingDataFlag){e.next=2;break}return e.abrupt("return");case 2:return this.fetchingDataFlag=!0,console.log("onHeaderReleased"),this.setState({pullingText:"刷新数据中,请稍等,2秒后自动收起"}),t=[],e.prev=6,e.next=9,this.mockFetchData();case 9:t=e.sent,e.next=14;break;case 12:e.prev=12,e.t0=e.catch(6);case 14:this.fetchingDataFlag=!1,this.setState({dataSource:t},(function(){n.listView.collapsePullHeader(),n.fetchTimes=0}));case 16:case"end":return e.stop()}}),e,this,[[6,12]])}))),function(){return t.apply(this,arguments)})},{key:"onHeaderPulling",value:function(e){this.fetchingDataFlag||(console.log("onHeaderPulling",e.contentOffset),e.contentOffset>Ue.pullContent.height?this.setState({pullingText:"松手,即可触发刷新"}):this.setState({pullingText:"继续下拉,触发刷新"}))}},{key:"onClickItem",value:function(e){console.log("item: ".concat(e," is clicked.."))}},{key:"getRowType",value:function(e){return this.state.dataSource[e].style}},{key:"getRowKey",value:function(e){return"row-".concat(e)}},{key:"mockFetchData",value:function(){var e=this;return new Promise((function(t){setTimeout((function(){e.fetchTimes+=1;var n=[];return e.fetchTimes<50&&(n=Ae),t(n)}),2e3)}))}},{key:"renderPullHeader",value:function(){var e=this.state.pullingText;return b.a.createElement(i.View,{style:Ue.pullContainer},b.a.createElement(i.Text,{style:Ue.pullContent},e))}},{key:"renderRow",value:function(e){var t=this,n=this.state,r=n.dataSource,o=n.loadingState,a=null,l=r[e],c=r.length===e+1;switch(l.style){case 1:a=b.a.createElement(De,{itemBean:l.itemBean,onClick:function(){return t.onClickItem(e)}});break;case 2:a=b.a.createElement(Me,{itemBean:l.itemBean,onClick:function(){return t.onClickItem(e)}});break;case 5:a=b.a.createElement(He,{itemBean:l.itemBean,onClick:function(){return t.onClickItem(e)}});break;case 100:a=b.a.createElement(i.Text,{style:Ue.loading},o)}return b.a.createElement(i.View,{style:Ue.container},b.a.createElement(i.View,{style:Ue.itemContainer},a),c?null:b.a.createElement(i.View,{style:Ue.splitter}))}},{key:"render",value:function(){var e=this,t=this.state.dataSource;return b.a.createElement(i.ListView,{ref:function(t){e.listView=t},style:{flex:1,backgroundColor:"#ffffff"},numberOfRows:t.length,getRowType:this.getRowType,getRowKey:this.getRowKey,renderRow:this.renderRow,renderPullHeader:this.renderPullHeader,onEndReached:this.onEndReached,onHeaderReleased:this.onHeaderReleased,onHeaderPulling:this.onHeaderPulling})}}]),a}(b.a.Component),Ye=i.StyleSheet.create({itemStyle:{width:100,height:100,lineHeight:100,borderWidth:1,borderColor:"#4c9afa",fontSize:80,margin:20,color:"#4c9afa",textAlign:"center"},verticalScrollView:{height:300,width:140,margin:20,borderColor:"#eee",borderWidth:1},itemTitle:{alignItems:"flex-start",justifyContent:"center",height:40,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10}});function Je(){return b.a.createElement(i.ScrollView,null,b.a.createElement(i.View,{style:Ye.itemTitle},b.a.createElement(i.Text,null,"Horizontal ScrollView")),b.a.createElement(i.View,null,b.a.createElement(i.ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,bounces:!0},b.a.createElement(i.Text,{style:Ye.itemStyle},"A"),b.a.createElement(i.Text,{style:Ye.itemStyle},"B"),b.a.createElement(i.Text,{style:Ye.itemStyle},"C"),b.a.createElement(i.Text,{style:Ye.itemStyle},"D"),b.a.createElement(i.Text,{style:Ye.itemStyle},"E"),b.a.createElement(i.Text,{style:Ye.itemStyle},"F"),b.a.createElement(i.Text,{style:Ye.itemStyle},"A"))),b.a.createElement(i.View,{style:Ye.itemTitle},b.a.createElement(i.Text,null,"Vertical ScrollView")),b.a.createElement(i.ScrollView,{bounces:!0,horizontal:!1,style:Ye.verticalScrollView,showsVerticalScrollIndicator:!1},b.a.createElement(i.Text,{style:Ye.itemStyle},"A"),b.a.createElement(i.Text,{style:Ye.itemStyle},"B"),b.a.createElement(i.Text,{style:Ye.itemStyle},"C"),b.a.createElement(i.Text,{style:Ye.itemStyle},"D"),b.a.createElement(i.Text,{style:Ye.itemStyle},"E"),b.a.createElement(i.Text,{style:Ye.itemStyle},"F"),b.a.createElement(i.Text,{style:Ye.itemStyle},"A")))}function Xe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Ze=i.StyleSheet.create({itemTitle:{alignItems:"flex-start",justifyContent:"center",height:40,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10},itemContent:{alignItems:"flex-start",justifyContent:"center",height:100,borderWidth:1,borderRadius:2,borderColor:"#e0e0e0",backgroundColor:"#ffffff",padding:10},normalText:{fontSize:14,lineHeight:18,color:"black"},button:{width:100,height:24,borderColor:"blue",borderWidth:1},buttonText:{width:100,lineHeight:24,textAlign:"center"},customFont:{color:"#0052d9",fontSize:32,fontFamily:"TTTGB"}}),$e=0,et=function(e){h()(n,e);var t=Xe(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={fontSize:16,textShadowColor:"grey",textShadowOffset:{x:1,y:1}},r.incrementFontSize=r.incrementFontSize.bind(ce()(r)),r.decrementFontSize=r.decrementFontSize.bind(ce()(r)),r.androidNestedTextWrapperStyle={height:100,lineHeight:100},r}return u()(n,[{key:"incrementFontSize",value:function(){var e=this.state.fontSize;24!==e&&this.setState({fontSize:e+1})}},{key:"decrementFontSize",value:function(){var e=this.state.fontSize;6!==e&&this.setState({fontSize:e-1})}},{key:"render",value:function(){var e=this,t=this.state,n=t.fontSize,r=t.textShadowColor,o=t.textShadowOffset,a=function(e){return b.a.createElement(i.View,{style:Ze.itemTitle},b.a.createElement(i.Text,{style:!0},e))};return b.a.createElement(i.ScrollView,{style:{padding:10}},a("shadow"),b.a.createElement(i.View,{style:[Ze.itemContent],onClick:function(){var t="red",n={x:10,y:1};$e%2==1&&(t="grey",n={x:1,y:1}),$e+=1,e.setState({textShadowColor:t,textShadowOffset:n})}},b.a.createElement(i.Text,{style:[Ze.normalText,{color:"#242424",textShadowOffset:o,textShadowRadius:3,textShadowColor:r}]},"Text shadow is grey with radius 3 and offset 1")),a("color"),b.a.createElement(i.View,{style:[Ze.itemContent]},b.a.createElement(i.Text,{style:[Ze.normalText,{color:"#242424"}]},"Text color is black"),b.a.createElement(i.Text,{style:[Ze.normalText,{color:"blue"}]},"Text color is blue"),b.a.createElement(i.Text,{style:[Ze.normalText,{color:"rgb(228,61,36)"}]},"This is red")),a("fontSize"),b.a.createElement(i.View,{style:Ze.itemContent},b.a.createElement(i.Text,{style:[Ze.normalText,{fontSize:n}]},"Text fontSize is ".concat(n)),b.a.createElement(i.View,{style:Ze.button,onClick:this.incrementFontSize},b.a.createElement(i.Text,{style:Ze.buttonText},"放大字体")),b.a.createElement(i.View,{style:Ze.button,onClick:this.decrementFontSize},b.a.createElement(i.Text,{style:Ze.buttonText},"缩小字体"))),a("fontStyle"),b.a.createElement(i.View,{style:Ze.itemContent},b.a.createElement(i.Text,{style:[Ze.normalText,{fontStyle:"normal"}]},"Text fontStyle is normal"),b.a.createElement(i.Text,{style:[Ze.normalText,{fontStyle:"italic"}]},"Text fontStyle is italic")),a("numberOfLines"),b.a.createElement(i.View,{style:Ze.itemContent},b.a.createElement(i.Text,{numberOfLines:1,style:Ze.normalText},"just one line just one line just one line just one line just one line just one line just one line just one line"),b.a.createElement(i.Text,{numberOfLines:2,style:Ze.normalText},"just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines")),a("textDecoration"),b.a.createElement(i.View,{style:Ze.itemContent},b.a.createElement(i.Text,{numberOfLines:1,style:[Ze.normalText,{textDecorationLine:"underline",textDecorationStyle:"dotted"}]},"underline"),b.a.createElement(i.Text,{numberOfLines:1,style:[Ze.normalText,{textDecorationLine:"line-through",textDecorationColor:"red"}]},"line-through")),a("Nest Text"),b.a.createElement(i.View,{style:Ze.itemContent},b.a.createElement(i.Text,{numberOfLines:3},b.a.createElement(i.Text,{numberOfLines:3,style:[Ze.normalText,{color:"#4c9afa"}]},"#SpiderMan#"),b.a.createElement(i.Text,{numberOfLines:3,style:Ze.normalText},"Hello world, I am a spider man and I have five friends in other universe."))),a("Custom font"),b.a.createElement(i.View,{style:Ze.itemContent},b.a.createElement(i.Text,{numberOfLines:1,style:Ze.customFont},"Hippy 跨端框架")),a("Text Nested"),b.a.createElement(i.View,{style:Ze.itemContent},b.a.createElement(i.Text,{style:"android"===i.Platform.OS?this.androidNestedTextWrapperStyle:{}},b.a.createElement(i.Text,{numberOfLines:1,style:Ze.normalText},"后面有张图片"),b.a.createElement(i.Image,{style:{width:70,height:35},source:{uri:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAtCAMAAABmgJ64AAAAOVBMVEX/Rx8AAAD/QiL/Tif/QyH/RR//QiH/QiP/RCD/QSL/Qxz/QyH/QiL/QiD/QyL/QiL/QiH/QyH/QiLwirLUAAAAEnRSTlMZAF4OTC7DrWzjI4iietrRk0EEv/0YAAAB0UlEQVRYw72Y0Y6sIAxAKwUFlFH7/x97izNXF2lN1pU5D800jD2hJAJCdwYZuAUyVbmToKh903IhQHgErAVH+ccV0KI+G2oBPMxJgPA4WAigAT8F0IRDgNAE3ARyfeMFDGSc3YHVFkTBAHKDAgkEyHjacae/GTjxFqAo8NbakXrL9DRy9B+BCQwRcXR9OBKmEuAmAFFgcy0agBnIc1xZsMPOI5loAoUsQFmQjDEL9YbpaeGYBMGRKKAuqFEFL/JXApCw/zFEZk9qgbLGBx0gXLISxT25IUBREEgh1II1fph/IViGnZnCcDDVAgfgVg6gCy6ZaClySbDQpAl04vCGaB4+xGcFRK8CLvW0IBb5bQGqAlNwU4C6oEIVTLTcmoEr0AWcpKsZ/H0NAtkLQffnFjkOqiC/TTWBL9AFCwXQBHgI7rXImMgjCZwFa50s6DRBXyALmIECuMASiWNPFgRTgSJwM+XW8PDCmbwndzdaNL8FMYXPNjASDVChnIvWlBI/MKadPV952HszbmXtRERhhQ0vGFA52SVSSVt7MjHvxfRK8cdTpqovn02dUcltMrwiKf+wQ1FxXKCk9en6e/eDNnP44h2thQEb35O/etNv/q3iHza+KuhqqhZAAAAAAElFTkSuQmCC"}}),b.a.createElement(i.Text,{numberOfLines:1,style:Ze.customFont},"前面有张图片"))))}}]),n}(b.a.Component);function tt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var nt=i.StyleSheet.create({container_style:{padding:10},input_style:{width:300,marginVertical:10,placeholderTextColor:"#aaaaaa",fontSize:16,color:"#242424",height:30,lineHeight:30},itemTitle:{alignItems:"flex-start",justifyContent:"center",height:40,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10},button:{width:200,borderColor:"#4c9afa",borderWidth:1,marginTop:5,marginBottom:5}}),rt=function(e){h()(n,e);var t=tt(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={textContent:""},r.changeInputContent=r.changeInputContent.bind(ce()(r)),r.focus=r.focus.bind(ce()(r)),r.blur=r.blur.bind(ce()(r)),r}return u()(n,[{key:"changeInputContent",value:function(){this.setState({textContent:"当前时间毫秒:".concat(Date.now())})}},{key:"focus",value:function(){this.input.focus()}},{key:"blur",value:function(){this.input.blur()}},{key:"render",value:function(){var e=this,t=this.state.textContent,n=function(e){return b.a.createElement(i.View,{style:nt.itemTitle},b.a.createElement(i.Text,null,e))};return b.a.createElement(i.ScrollView,{style:nt.container_style},n("text"),b.a.createElement(i.TextInput,{ref:function(t){e.input=t},style:nt.input_style,placeholder:"text",defaultValue:t}),b.a.createElement(i.View,{style:nt.button,onClick:this.changeInputContent},b.a.createElement(i.Text,null,"点击改变输入框内容")),b.a.createElement(i.View,{style:nt.button,onClick:this.focus},b.a.createElement(i.Text,null,"Focus")),b.a.createElement(i.View,{style:nt.button,onClick:this.blur},b.a.createElement(i.Text,null,"Blur")),n("numeric"),b.a.createElement(i.TextInput,{style:nt.input_style,keyboardType:"numeric",placeholder:"numeric"}),n("phone-pad"),b.a.createElement(i.TextInput,{style:nt.input_style,keyboardType:"phone-pad",placeholder:"phone-pad"}),n("password"),b.a.createElement(i.TextInput,{style:nt.input_style,keyboardType:"password",placeholder:"password"}),n("maxLength"),b.a.createElement(i.TextInput,{style:nt.input_style,placeholder:"maxLength=5",maxLength:5}))}}]),n}(g.Component),ot=n.p+"assets/defaultSource.jpg",at=i.StyleSheet.create({itemTitle:{alignItems:"flex-start",justifyContent:"center",height:40,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10},rectangle:{width:160,height:80,marginVertical:10},bigRectangle:{width:200,height:100,borderColor:"#eee",borderWidth:1,padding:10,marginVertical:10},smallRectangle:{width:40,height:40,borderRadius:10}});function it(){var e=function(e){return b.a.createElement(i.View,{style:at.itemTitle},b.a.createElement(i.Text,null,e))};return b.a.createElement(i.ScrollView,{style:{padding:10}},e("backgroundColor"),b.a.createElement(i.View,{style:[at.rectangle,{backgroundColor:"#4c9afa"}]}),e("backgroundImage"),b.a.createElement(i.View,{style:[at.rectangle,{alignItems:"center",justifyContent:"center",marginTop:20,backgroundImage:ot}],accessible:!0,accessibilityLabel:"背景图",accessibilityRole:"image",accessibilityState:{disabled:!1,selected:!0,checked:!1,expanded:!1,busy:!0},accessibilityValue:{min:1,max:10,now:5,text:"middle"}},b.a.createElement(i.Text,{style:{color:"white"}},"背景图")),e("backgroundImage linear-gradient"),b.a.createElement(i.View,{style:[at.rectangle,{alignItems:"center",justifyContent:"center",marginTop:20,borderWidth:2,borderColor:"black",borderRadius:2,backgroundImage:"linear-gradient(30deg, blue 10%, yellow 40%, red 50%);"}]},b.a.createElement(i.Text,{style:{color:"white"}},"渐变色")),e("border props"),b.a.createElement(i.View,{style:[at.rectangle,{borderColor:"#242424",borderRadius:4,borderWidth:1}]}),e("flex props"),b.a.createElement(i.View,{style:[at.bigRectangle,{flexDirection:"row",alignItems:"center",justifyContent:"space-between"}]},b.a.createElement(i.View,{style:[at.smallRectangle,{backgroundColor:"yellow"}]}),b.a.createElement(i.View,{style:[at.smallRectangle,{backgroundColor:"blue"}]}),b.a.createElement(i.View,{style:[at.smallRectangle,{backgroundColor:"green"}]})))}var lt=i.StyleSheet.create({pageContainer:{alignItems:"center",justifyContent:"center",flex:1,paddingTop:20},mainRec:{backgroundColor:"#4c9afaAA",width:256,height:48,marginBottom:10,marginTop:156},title:{verticalAlign:"middle",lineHeight:48,height:48,fontSize:16,color:"#f44837",alignSelf:"center"},shapeBase:{width:128,height:128,backgroundColor:"#4c9afa"},square:{},circle:{borderRadius:64},triangle:{borderTopWidth:0,borderRightWidth:70,borderBottomWidth:128,borderLeftWidth:70,borderTopColor:"transparent",borderRightColor:"transparent",borderLeftColor:"transparent",borderBottomColor:"#4c9afa",backgroundColor:"transparent",width:140}}),ct="SquarePagerView",st="TrianglePagerView",ut="CirclePagerView";function ft(e,t){var n=function(t){return b.a.createElement(i.View,{style:lt.pageContainer,key:t},b.a.createElement(i.View,{style:[lt.shapeBase,e]}),b.a.createElement(i.View,{style:lt.mainRec},t?b.a.createElement(i.Text,{style:lt.title},t):null))};return n.displayName=t,n}var ht=ft(lt.square,ct),dt=ft(lt.triangle,st),mt=ft(lt.circle,ut);function pt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var yt=i.StyleSheet.create({dotContainer:{position:"absolute",bottom:10,left:0,right:0,flexDirection:"row",alignItems:"center",justifyContent:"center"},dot:{width:6,height:6,borderRadius:3,margin:3,backgroundColor:"#BBBBBB"},selectDot:{backgroundColor:"#000000"},container:{height:500},buttonContainer:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12},button:{width:120,height:36,backgroundColor:"#4c9afa",borderRadius:18,alignItems:"center",justifyContent:"center"},buttonText:{fontSize:16,color:"#fff"}}),gt=function(e){h()(n,e);var t=pt(n);function n(e){var r;return c()(this,n),r=t.call(this,e),Z()(ce()(r),"state",{selectedIndex:0}),r.onPageSelected=r.onPageSelected.bind(ce()(r)),r}return u()(n,[{key:"onPageSelected",value:function(e){console.log("=====onPageSelected",e.position),this.setState({selectedIndex:e.position})}},{key:"onPageScrollStateChanged",value:function(e){console.log("=====onPageScrollStateChanged===",e)}},{key:"onPageScroll",value:function(e){var t=e.offset,n=e.position;console.log("onPageScroll",t,n)}},{key:"render",value:function(){var e=this,t=this.state.selectedIndex;return b.a.createElement(i.View,{style:{flex:1,backgroundColor:"#ffffff"}},b.a.createElement(i.View,{style:yt.buttonContainer},b.a.createElement(i.View,{style:yt.button,onClick:function(){e.viewpager.setPage(2)}},b.a.createElement(i.Text,{style:yt.buttonText},"动效滑到第3页")),b.a.createElement(i.View,{style:yt.button,onClick:function(){return e.viewpager.setPageWithoutAnimation(0)}},b.a.createElement(i.Text,{style:yt.buttonText},"直接滑到第1页"))),b.a.createElement(i.ViewPager,{ref:function(t){e.viewpager=t},style:yt.container,initialPage:0,keyboardDismissMode:"none",scrollEnabled:!0,onPageSelected:this.onPageSelected,onPageScroll:this.onPageScroll},[ht(),dt(),mt()]),b.a.createElement(i.View,{style:yt.dotContainer},new Array(3).fill(0).map((function(e,n){var r=n===t;return b.a.createElement(i.View,{style:[yt.dot,r?yt.selectDot:null]})}))))}}]),n}(b.a.Component),bt=i.StyleSheet.create({itemTitle:{alignItems:"flex-start",justifyContent:"center",height:40,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10},webViewStyle:{width:300,height:300,borderRadius:10}});function vt(){return b.a.createElement(i.View,{style:{padding:10}},b.a.createElement(i.View,{style:bt.itemTitle},b.a.createElement(i.Text,null,"WebView 示例")),b.a.createElement(i.WebView,{source:{uri:"https://www.qq.com"},method:"get",userAgent:"Mozilla/5.0 (Linux; U; Android 5.1.1; zh-cn; vivo X7 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/8.2 Mobile Safari/537.36",style:bt.webViewStyle,onLoad:function(e){var t=e.url;return console.log("webview onload",t)},onLoadStart:function(e){var t=e.url;return console.log("webview onLoadStart",t)},onLoadEnd:function(e){var t=e.url;return console.log("webview onLoadEnd",t)}}))}var wt=i.StyleSheet.create({shadowDemo:{flex:1,overflowY:"scroll"},shadowDemoCubeAndroid:{position:"absolute",left:50,top:50,width:170,height:170,boxShadowOpacity:.6,boxShadowRadius:5,boxShadowColor:"#4c9afa",borderRadius:5},shadowDemoContentAndroid:{position:"absolute",left:5,top:5,width:160,height:160,backgroundColor:"grey",borderRadius:5,display:"flex",justifyContent:"center",alignItems:"center"},shadowDemoCubeIos:{position:"absolute",left:50,top:50,width:160,height:160,boxShadowOpacity:.6,boxShadowRadius:5,boxShadowSpread:1,boxShadowColor:"#4c9afa",borderRadius:5},shadowDemoContentIos:{width:160,height:160,backgroundColor:"grey",borderRadius:5,display:"flex",justifyContent:"center",alignItems:"center"},text:{color:"white"}}),xt=i.StyleSheet.create({shadowDemoCubeAndroid:{position:"absolute",left:50,top:300,width:175,height:175,boxShadowOpacity:.6,boxShadowRadius:5,boxShadowOffsetX:15,boxShadowOffsetY:15,boxShadowColor:"#4c9afa"},shadowDemoContentAndroid:{width:160,height:160,backgroundColor:"grey",display:"flex",justifyContent:"center",alignItems:"center"},shadowDemoCubeIos:{position:"absolute",left:50,top:300,width:160,height:160,boxShadowOpacity:.6,boxShadowRadius:5,boxShadowOffsetX:10,boxShadowOffsetY:10,boxShadowSpread:1,boxShadowColor:"#4c9afa"},shadowDemoContentIos:{width:160,height:160,backgroundColor:"grey",display:"flex",justifyContent:"center",alignItems:"center"},text:{color:"white"}});function St(){return b.a.createElement(i.View,{style:wt.shadowDemo},"android"===i.Platform.OS?b.a.createElement(i.View,{style:wt.shadowDemoCubeAndroid},b.a.createElement(i.View,{style:wt.shadowDemoContentAndroid},b.a.createElement(i.Text,{style:wt.text},"没有偏移阴影样式"))):b.a.createElement(i.View,{style:wt.shadowDemoCubeIos},b.a.createElement(i.View,{style:wt.shadowDemoContentIos},b.a.createElement(i.Text,{style:wt.text},"没有偏移阴影样式"))),"android"===i.Platform.OS?b.a.createElement(i.View,{style:xt.shadowDemoCubeAndroid},b.a.createElement(i.View,{style:xt.shadowDemoContentAndroid},b.a.createElement(i.Text,{style:xt.text},"偏移阴影样式"))):b.a.createElement(i.View,{style:xt.shadowDemoCubeIos},b.a.createElement(i.View,{style:xt.shadowDemoContentIos},b.a.createElement(i.Text,{style:xt.text},"偏移阴影样式"))))}function Et(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Tt=Ae.filter((function(e){return 2!==e.style})),Ct=i.StyleSheet.create({container:{backgroundColor:"#ffffff"},itemContainer:{padding:12},splitter:{marginLeft:12,marginRight:12,height:.5,backgroundColor:"#e5e5e5"},loading:{fontSize:11,color:"#aaaaaa",alignSelf:"center"},pullContainer:{height:60,backgroundColor:"green"},pullContent:{lineHeight:60,color:"white",height:60,textAlign:"center"},pullFooter:{flex:1,height:40,backgroundColor:"#4c9afa",justifyContent:"center",alignItems:"center"}}),Rt=function(e){h()(a,e);var t,n,r,o=Et(a);function a(e){var t;return c()(this,a),(t=o.call(this,e)).state={dataSource:[],pullingText:"继续下拉触发刷新",loadingState:"正在加载..."},t.numberOfColumns=2,t.columnSpacing=6,t.interItemSpacing=6,t.mockFetchData=t.mockFetchData.bind(ce()(t)),t.renderItem=t.renderItem.bind(ce()(t)),t.getItemType=t.getItemType.bind(ce()(t)),t.getItemKey=t.getItemKey.bind(ce()(t)),t.onEndReached=t.onEndReached.bind(ce()(t)),t.onRefresh=t.onRefresh.bind(ce()(t)),t.getRefresh=t.getRefresh.bind(ce()(t)),t.renderPullFooter=t.renderPullFooter.bind(ce()(t)),t.renderBanner=t.renderBanner.bind(ce()(t)),t}return u()(a,[{key:"componentDidMount",value:(r=ie()(ue.a.mark((function e(){var t;return ue.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.mockFetchData();case 2:t=e.sent,this.setState({dataSource:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"onEndReached",value:(n=ie()(ue.a.mark((function e(){var t,n,r;return ue.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.state.dataSource,!this.loadMoreDataFlag){e.next=3;break}return e.abrupt("return");case 3:return this.loadMoreDataFlag=!0,this.setState({loadingState:"加载更多..."}),n=[],e.prev=6,e.next=9,this.mockFetchData();case 9:n=e.sent,e.next=14;break;case 12:e.prev=12,e.t0=e.catch(6);case 14:0===n.length&&this.setState({loadingState:"没有更多数据"}),r=[].concat(w()(t),w()(n)),this.setState({dataSource:r}),this.loadMoreDataFlag=!1;case 18:case"end":return e.stop()}}),e,this,[[6,12]])}))),function(){return n.apply(this,arguments)})},{key:"renderPullFooter",value:function(){return 0===this.state.dataSource.length?null:b.a.createElement(i.View,{style:Ct.pullFooter},b.a.createElement(i.Text,{style:{color:"white"}},this.state.loadingState))}},{key:"onRefresh",value:(t=ie()(ue.a.mark((function e(){var t=this;return ue.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:setTimeout(ie()(ue.a.mark((function e(){var n;return ue.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.mockFetchData();case 2:n=e.sent,t.setState({dataSource:n}),t.refresh.refreshComplected();case 5:case"end":return e.stop()}}),e)}))),1e3);case 1:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"getRefresh",value:function(){return b.a.createElement(i.View,{style:{flex:1,height:40,justifyContent:"center",alignItems:"center",backgroundColor:"#4c9afa"}},b.a.createElement(i.Text,{style:{height:40,lineHeight:40,textAlign:"center",color:"white"}},"下拉刷新中..."))}},{key:"onClickItem",value:function(e){console.log("item: ".concat(e," is clicked.."))}},{key:"getItemType",value:function(e){return this.state.dataSource[e].style}},{key:"getItemKey",value:function(e){return"row-".concat(e)}},{key:"onItemClick",value:function(e){console.log("onItemClick",e),this.listView.scrollToIndex({index:e,animation:!0})}},{key:"renderBanner",value:function(){return"android"===i.Platform.OS||0===this.state.dataSource.length?null:b.a.createElement(i.View,{style:{backgroundColor:"grey",height:100,justifyContent:"center",alignItems:"center"}},b.a.createElement(i.Text,{style:{fontSize:20,color:"white",lineHeight:100,height:100}},"Banner View"))}},{key:"renderItem",value:function(e){var t=this,n=null,r=this.state.dataSource[e];switch(r.style){case 1:n=b.a.createElement(De,{itemBean:r.itemBean});break;case 2:n=b.a.createElement(Me,{itemBean:r.itemBean});break;case 5:n=b.a.createElement(He,{itemBean:r.itemBean})}return b.a.createElement(i.View,{onClick:function(){return t.onItemClick(e)},style:Ct.container},b.a.createElement(i.View,{style:Ct.itemContainer},n),b.a.createElement(i.View,{style:Ct.splitter}))}},{key:"mockFetchData",value:function(){return new Promise((function(e){setTimeout((function(){var t=[].concat(w()(Tt),w()(Tt));return e(t)}),600)}))}},{key:"getWaterfallContentInset",value:function(){return{top:0,left:5,bottom:0,right:5}}},{key:"getItemStyle",value:function(){var e=this.numberOfColumns,t=this.columnSpacing,n=i.Dimensions.get("screen").width,r=this.getWaterfallContentInset();return{width:(n-r.left-r.right-(e-1)*t)/e}}},{key:"render",value:function(){var e=this,t=this.state.dataSource,n=this.numberOfColumns,r=this.columnSpacing,o=this.interItemSpacing,a=this.getWaterfallContentInset();return b.a.createElement(i.RefreshWrapper,{ref:function(t){e.refresh=t},style:{flex:1},onRefresh:this.onRefresh,bounceTime:100,getRefresh:this.getRefresh},b.a.createElement(i.WaterfallView,{ref:function(t){e.listView=t},renderBanner:this.renderBanner,numberOfColumns:n,columnSpacing:r,interItemSpacing:o,numberOfItems:t.length,style:{flex:1},renderItem:this.renderItem,onEndReached:this.onEndReached,getItemType:this.getItemType,getItemKey:this.getItemKey,contentInset:a,getItemStyle:function(){return e.getItemStyle()},containPullFooter:!0,renderPullFooter:this.renderPullFooter}))}}]),a}(b.a.Component);function kt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var At="#4c9afa",Vt="#f44837",jt=i.StyleSheet.create({container:{paddingHorizontal:10},square:{width:80,height:80,backgroundColor:Vt},showArea:{height:150,marginVertical:10},button:{borderColor:At,borderWidth:2,justifyContent:"center",alignItems:"center",width:70,borderRadius:8,height:50,marginTop:20,marginRight:8},buttonText:{fontSize:20,color:At,textAlign:"center",textAlignVertical:"center"},colorText:{fontSize:14,color:"white",textAlign:"center",textAlignVertical:"center"},buttonContainer:{flexDirection:"row",alignItems:"center"},title:{fontSize:24,marginTop:8}}),It=function(e){h()(n,e);var t=kt(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={},r}return u()(n,[{key:"componentWillMount",value:function(){this.horizonAnimation=new i.Animation({startValue:150,toValue:20,duration:1e3,delay:500,mode:"timing",timingFunction:"linear",repeatCount:"loop"}),this.verticalAnimation=new i.Animation({startValue:80,toValue:40,duration:1e3,delay:0,mode:"timing",timingFunction:"linear",repeatCount:"loop"}),this.scaleAnimationSet=new i.AnimationSet({children:[{animation:new i.Animation({startValue:1,toValue:1.2,duration:1e3,delay:0,mode:"timing",timingFunction:"linear"}),follow:!1},{animation:new i.Animation({startValue:1.2,toValue:.2,duration:1e3,delay:0,mode:"timing",timingFunction:"linear"}),follow:!0}],repeatCount:"loop"}),this.bgColorAnimationSet=new i.AnimationSet({children:[{animation:new i.Animation({startValue:"red",toValue:"yellow",valueType:"color",duration:1e3,delay:0,mode:"timing",timingFunction:"linear"}),follow:!1},{animation:new i.Animation({startValue:"yellow",toValue:"blue",duration:1e3,valueType:"color",delay:0,mode:"timing",timingFunction:"linear"}),follow:!0}],repeatCount:"loop"}),this.txtColorAnimationSet=new i.AnimationSet({children:[{animation:new i.Animation({startValue:"white",toValue:"yellow",valueType:"color",duration:1e3,delay:0,mode:"timing",timingFunction:"linear"}),follow:!1},{animation:new i.Animation({startValue:"yellow",toValue:"white",duration:1e3,valueType:"color",delay:0,mode:"timing",timingFunction:"linear"}),follow:!0}],repeatCount:"loop"}),this.cubicBezierScaleAnimationSet=new i.AnimationSet({children:[{animation:new i.Animation({startValue:0,toValue:1,duration:1e3,delay:0,mode:"timing",timingFunction:"cubic-bezier(.45,2.84,.38,.5)"}),follow:!1},{animation:new i.Animation({startValue:1,toValue:0,duration:1e3,mode:"timing",timingFunction:"cubic-bezier(.17,1.45,.78,.14)"}),follow:!0}],repeatCount:"loop"})}},{key:"componentDidMount",value:function(){"web"===i.Platform.OS&&(this.verticalAnimation.setRef(this.verticalRef),this.horizonAnimation.setRef(this.horizonRef),this.scaleAnimationSet.setRef(this.scaleRef),this.bgColorAnimationSet.setRef(this.bgColorRef),this.txtColorAnimationSet.setRef(this.textColorRef),this.cubicBezierScaleAnimationSet.setRef(this.cubicBezierScaleRef)),this.horizonAnimation.onHippyAnimationStart((function(){console.log("on animation start!!!")})),this.horizonAnimation.onHippyAnimationEnd((function(){console.log("on animation end!!!")})),this.horizonAnimation.onHippyAnimationCancel((function(){console.log("on animation cancel!!!")})),this.horizonAnimation.onHippyAnimationRepeat((function(){console.log("on animation end!!!")}))}},{key:"componentWillUnmount",value:function(){this.scaleAnimationSet&&this.scaleAnimationSet.destroy(),this.horizonAnimation&&this.horizonAnimation.destroy(),this.verticalAnimation&&this.verticalAnimation.destroy(),this.cubicBezierScaleAnimationSet&&this.cubicBezierScaleAnimationSet.destroy()}},{key:"render",value:function(){var e=this;return b.a.createElement(i.ScrollView,{style:jt.container},b.a.createElement(i.Text,{style:jt.title},"水平位移动画"),b.a.createElement(i.View,{style:jt.buttonContainer},b.a.createElement(i.View,{style:jt.button,onClick:function(){e.horizonAnimation.start()}},b.a.createElement(i.Text,{style:jt.buttonText},"开始")),b.a.createElement(i.View,{style:[jt.button],onClick:function(){e.horizonAnimation.pause()}},b.a.createElement(i.Text,{style:jt.buttonText},"暂停")),b.a.createElement(i.View,{style:jt.button,onClick:function(){e.horizonAnimation.resume()}},b.a.createElement(i.Text,{style:jt.buttonText},"继续")),b.a.createElement(i.View,{style:jt.button,onClick:function(){e.horizonAnimation.updateAnimation({startValue:50,toValue:100})}},b.a.createElement(i.Text,{style:jt.buttonText},"更新"))),b.a.createElement(i.View,{style:jt.showArea},b.a.createElement(i.View,{ref:function(t){e.horizonRef=t},style:[jt.square,{transform:[{translateX:this.horizonAnimation}]}]})),b.a.createElement(i.Text,{style:jt.title},"高度形变动画"),b.a.createElement(i.View,{style:jt.buttonContainer},b.a.createElement(i.View,{style:jt.button,onClick:function(){e.verticalAnimation.start()}},b.a.createElement(i.Text,{style:jt.buttonText},"开始")),b.a.createElement(i.View,{style:[jt.button],onClick:function(){e.verticalAnimation.pause()}},b.a.createElement(i.Text,{style:jt.buttonText},"暂停")),b.a.createElement(i.View,{style:jt.button,onClick:function(){e.verticalAnimation.resume()}},b.a.createElement(i.Text,{style:jt.buttonText},"继续"))),b.a.createElement(i.View,{style:jt.showArea},b.a.createElement(i.View,{ref:function(t){e.verticalRef=t},style:[jt.square,{height:this.verticalAnimation}]})),b.a.createElement(i.Text,{style:jt.title},"组合形变动画"),b.a.createElement(i.View,{style:jt.buttonContainer},b.a.createElement(i.View,{style:jt.button,onClick:function(){e.scaleAnimationSet.start()}},b.a.createElement(i.Text,{style:jt.buttonText},"开始")),b.a.createElement(i.View,{style:[jt.button],onClick:function(){e.scaleAnimationSet.pause()}},b.a.createElement(i.Text,{style:jt.buttonText},"暂停")),b.a.createElement(i.View,{style:jt.button,onClick:function(){e.scaleAnimationSet.resume()}},b.a.createElement(i.Text,{style:jt.buttonText},"继续"))),b.a.createElement(i.View,{style:[jt.showArea,{marginVertical:20}]},b.a.createElement(i.View,{ref:function(t){e.scaleRef=t},style:[jt.square,{transform:[{scale:this.scaleAnimationSet}]}]})),b.a.createElement(i.Text,{style:jt.title},"颜色渐变动画(文字渐变仅Android支持)"),b.a.createElement(i.View,{style:jt.buttonContainer},b.a.createElement(i.View,{style:jt.button,onClick:function(){e.bgColorAnimationSet.start(),e.txtColorAnimationSet.start()}},b.a.createElement(i.Text,{style:jt.buttonText},"开始")),b.a.createElement(i.View,{style:[jt.button],onClick:function(){e.bgColorAnimationSet.pause(),e.txtColorAnimationSet.pause()}},b.a.createElement(i.Text,{style:jt.buttonText},"暂停")),b.a.createElement(i.View,{style:jt.button,onClick:function(){e.bgColorAnimationSet.resume(),e.txtColorAnimationSet.resume()}},b.a.createElement(i.Text,{style:jt.buttonText},"继续"))),b.a.createElement(i.View,{style:[jt.showArea,{marginVertical:20}]},b.a.createElement(i.View,{ref:function(t){e.bgColorRef=t},style:[jt.square,{justifyContent:"center",alignItems:"center"},{backgroundColor:this.bgColorAnimationSet}]},b.a.createElement(i.Text,{ref:function(t){e.textColorRef=t},style:[jt.colorText,{color:"android"===i.Platform.OS?this.txtColorAnimationSet:"white"}]},"颜色渐变背景和文字"))),b.a.createElement(i.Text,{style:jt.title},"贝塞尔曲线动画"),b.a.createElement(i.View,{style:jt.buttonContainer},b.a.createElement(i.View,{style:jt.button,onClick:function(){e.cubicBezierScaleAnimationSet.start()}},b.a.createElement(i.Text,{style:jt.buttonText},"开始")),b.a.createElement(i.View,{style:[jt.button],onClick:function(){e.cubicBezierScaleAnimationSet.pause()}},b.a.createElement(i.Text,{style:jt.buttonText},"暂停")),b.a.createElement(i.View,{style:jt.button,onClick:function(){e.cubicBezierScaleAnimationSet.resume()}},b.a.createElement(i.Text,{style:jt.buttonText},"继续"))),b.a.createElement(i.View,{style:[jt.showArea,{marginVertical:20}]},b.a.createElement(i.View,{ref:function(t){e.cubicBezierScaleRef=t},style:[jt.square,{transform:[{scale:this.cubicBezierScaleAnimationSet}]}]})))}}]),n}(b.a.Component);function Ot(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Dt=i.StyleSheet.create({containerStyle:{margin:20,alignItems:"center",flexDirection:"column"},itemGroupStyle:{flexDirection:"row",marginTop:10,borderColor:"#4c9afa",borderWidth:1,width:100,height:40,justifyContent:"center",alignItems:"center"},viewGroupStyle:{flexDirection:"row",marginTop:10},infoStyle:{width:60,height:40,fontSize:16,color:"#4c9afa",textAlign:"center"},inputStyle:{width:200,height:40,placeholderTextColor:"#aaaaaa",underlineColorAndroid:"#4c9afa",fontSize:16,color:"#242424",textAlign:"left"},buttonStyle:{textAlign:"center",fontSize:16,color:"#4c9afa",backgroundColor:"#4c9afa11",marginLeft:10,marginRight:10}}),Pt=function(e){h()(n,e);var t=Ot(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={result:""},r.onTextChangeKey=r.onTextChangeKey.bind(ce()(r)),r.onTextChangeValue=r.onTextChangeValue.bind(ce()(r)),r.onClickSet=r.onClickSet.bind(ce()(r)),r.onTextChangeKey=r.onTextChangeKey.bind(ce()(r)),r.onClickGet=r.onClickGet.bind(ce()(r)),r}return u()(n,[{key:"onClickSet",value:function(){var e=this.state,t=e.key,n=e.value;t&&i.AsyncStorage.setItem(t,n)}},{key:"onClickGet",value:function(){var e=this,t=this.state.key;t&&i.AsyncStorage.getItem(t).then((function(t){e.setState({result:t})}))}},{key:"onTextChangeKey",value:function(e){this.setState({key:e})}},{key:"onTextChangeValue",value:function(e){this.setState({value:e})}},{key:"render",value:function(){var e=this.state.result;return b.a.createElement(i.ScrollView,{style:Dt.containerStyle},b.a.createElement(i.View,{style:Dt.viewGroupStyle},b.a.createElement(i.Text,{style:Dt.infoStyle},"Key:"),b.a.createElement(i.TextInput,{style:Dt.inputStyle,onChangeText:this.onTextChangeKey})),b.a.createElement(i.View,{style:Dt.viewGroupStyle},b.a.createElement(i.Text,{style:Dt.infoStyle},"Value:"),b.a.createElement(i.TextInput,{style:Dt.inputStyle,onChangeText:this.onTextChangeValue})),b.a.createElement(i.View,{style:Dt.itemGroupStyle,onClick:this.onClickSet},b.a.createElement(i.Text,{style:Dt.buttonStyle},"Set")),b.a.createElement(i.View,{style:[Dt.viewGroupStyle,{marginTop:60}]},b.a.createElement(i.Text,{style:Dt.infoStyle},"Key:"),b.a.createElement(i.TextInput,{style:Dt.inputStyle,onChangeText:this.onTextChangeKey})),b.a.createElement(i.View,{style:[Dt.viewGroupStyle,{display:"none"}]},b.a.createElement(i.Text,{style:Dt.infoStyle},"Value:"),b.a.createElement(i.Text,{style:[Dt.infoStyle,{width:200}]},e)),b.a.createElement(i.View,{style:Dt.itemGroupStyle,onClick:this.onClickGet},b.a.createElement(i.Text,{style:Dt.buttonStyle},"Get")))}}]),n}(b.a.Component);function _t(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Lt=i.StyleSheet.create({itemTitle:{alignItems:"flex-start",justifyContent:"center",height:40,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10},defaultText:{marginVertical:4,fontSize:18,lineHeight:24,color:"#242424"},copiedText:{color:"#aaa"},button:{backgroundColor:"#4c9afa",borderRadius:4,height:30,marginVertical:4,paddingHorizontal:6,alignItems:"center",justifyContent:"center"},buttonText:{fontSize:16,color:"white"}}),Bt=function(e){h()(n,e);var t=_t(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={hasCopied:!1,text:"Winter is coming",clipboardText:"快点上面的按钮啊魂淡"},r}return u()(n,[{key:"render",value:function(){var e=this,t=function(e){return b.a.createElement(i.View,{style:Lt.itemTitle},b.a.createElement(i.Text,null,e))},n=this.state,r=n.hasCopied,o=n.text,a=n.clipboardText,l=r?" (已复制) ":"";return b.a.createElement(i.ScrollView,{style:{padding:10}},t("文本复制到剪贴板"),b.a.createElement(i.Text,{style:Lt.defaultText},o),b.a.createElement(i.View,{style:Lt.button,onClick:function(){i.Clipboard.setString(o),e.setState({hasCopied:!0})}},b.a.createElement(i.Text,{style:Lt.buttonText},"点击复制以上文案".concat(l))),t("获取剪贴板内容"),b.a.createElement(i.View,{style:Lt.button,onClick:ie()(ue.a.mark((function t(){var n;return ue.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.Clipboard.getString();case 3:n=t.sent,e.setState({clipboardText:n}),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),console.error(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})))},b.a.createElement(i.Text,{style:Lt.buttonText},"点击获取剪贴板内容")),b.a.createElement(i.Text,{style:[Lt.defaultText,Lt.copiedText]},a))}}]),n}(b.a.Component);function Mt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var zt=i.StyleSheet.create({text:{fontSize:14,color:"#242424",alignSelf:"center"},container:{flex:1},itemTitle:{alignItems:"flex-start",justifyContent:"center",height:80,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10},itemContent:{alignItems:"flex-start",justifyContent:"center",height:100,borderBottomWidth:1,borderLeftWidth:1,borderRightWidth:1,borderRadius:2,borderColor:"#e0e0e0",backgroundColor:"#ffffff",padding:10},normalText:{fontSize:14,lineHeight:18,color:"black"}}),Ft=function(e){h()(n,e);var t=Mt(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={infoText:"",infoText2:""},r}return u()(n,[{key:"render",value:function(){var e=this,t=this.state,n=t.infoText,r=t.infoText2;return b.a.createElement(i.ScrollView,{style:zt.container},b.a.createElement(i.View,{style:zt.itemTitle,onPress:function(){var t=new i.HippyEventEmitter;e.call=t.addListener("NORMAL_EVENT",(function(t){e.setState({infoText:JSON.stringify(t)})})),Object(i.callNative)("MyEvent","btnClicked")}},b.a.createElement(i.Text,null,"客户端向前端单向通信"),b.a.createElement(i.Text,null,"点此终端会发送NORMAL_EVENT事件"),b.a.createElement(i.Text,null,"事件接收结果:".concat(n))),b.a.createElement(i.View,{style:zt.itemTitle,onPress:function(){var t=new i.HippyEventEmitter;e.call=t.addListener("COUNT_DOWN",(function(t){e.setState({infoText2:JSON.stringify(t)})})),Object(i.callNative)("MyEvent","addListener","COUNT_DOWN")}},b.a.createElement(i.Text,null,"客户端向前端单向通信的进阶用法"),b.a.createElement(i.Text,null,"点此终端会发送COUNT_DOWN事件"),b.a.createElement(i.Text,null,"事件接收结果:".concat(r))))}}]),n}(b.a.Component);function Wt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Ht=i.StyleSheet.create({text:{fontSize:14,color:"#242424",alignSelf:"center"},container:{flex:1,justifyContent:"center"}}),Nt=function(e){h()(r,e);var t,n=Wt(r);function r(e){var t;return c()(this,r),(t=n.call(this,e)).state={infoText:"正在获取.."},t.listener=null,t}return u()(r,[{key:"componentWillMount",value:(t=ie()(ue.a.mark((function e(){var t,n;return ue.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this,e.next=3,i.NetInfo.fetch();case 3:n=e.sent,this.setState({infoText:n}),this.listener=i.NetInfo.addEventListener("change",(function(e){t.setState({infoText:"收到通知: ".concat(e.network_info)})}));case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"componentDidMount",value:function(){var e=this;this.listener&&i.NetInfo.removeEventListener("change",this.listener),fetch("https://m.baidu.com",{headers:{Refer:"https://now.qq.com",Cookie:["harry=guo5","xxx=5"]}}).then((function(t){return console.log("成功",t),e.setState({infoText:"成功: ".concat(t.body)}),t})).catch((function(t){e.setState({infoText:"收到错误: ".concat(t)}),console.error("收到错误:",t)})),i.NetworkModule.setCookie("http://3gxx.qq.com","name=harryguo;gender=male"),i.NetworkModule.getCookies("http://3gxx.qq.com").then((function(e){console.log("cookie: ".concat(e))}))}},{key:"render",value:function(){var e=this.state.infoText;return b.a.createElement(i.ScrollView,{style:Ht.container},b.a.createElement(i.Text,{style:Ht.text},e))}}]),r}(b.a.Component),Kt={log:function(e){Object(i.callNative)("TestModule","log",e)},helloNative:function(e){Object(i.callNative)("TestModule","helloNative",e)},helloNativeWithPromise:function(e){return Object(i.callNativeWithPromise)("TestModule","helloNativeWithPromise",e)}};function qt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Gt,Ut=function(e){h()(n,e);var t=qt(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={hello:"TestModule log"},r}return u()(n,[{key:"componentDidMount",value:function(){var e=this;Kt.log("hello i am from js"),Kt.helloNative({hello:"i am form js"}),Kt.helloNativeWithPromise({hello:"i am form js"}).then((function(t){e.setState({hello:JSON.stringify(t)})}))}},{key:"render",value:function(){var e=this.state.hello;return b.a.createElement(i.Text,{style:{color:"red"}},e)}}]),n}(b.a.Component),Qt=n("./node_modules/@babel/runtime/helpers/slicedToArray.js"),Yt=n.n(Qt),Jt=i.StyleSheet.create({fullScreen:{flex:1},row:{flexDirection:"row"},title:{color:"#ccc"},button:{height:56,backgroundColor:"#4c9afa",borderColor:"#5dabfb",borderStyle:"solid",borderWidth:1,paddingHorizontal:20,fontSize:16,textAlign:"center",lineHeight:56,color:"#fff",margin:10},input:{color:"black",flex:1,height:36,lineHeight:36,fontSize:14,borderBottomColor:"#4c9afa",borderBottomStyle:"solid",borderBottomWidth:1,padding:0},output:{color:"black"}}),Xt="wss://echo.websocket.org",Zt="Rock it with Hippy WebSocket";var $t=function(){var e=Object(g.useRef)(null),t=Object(g.useRef)(null),n=Object(g.useState)([]),r=Yt()(n,2),o=r[0],a=r[1],l=function(e){a((function(t){return[e].concat(w()(t))}))};return b.a.createElement(i.View,{style:Jt.fullScreen},b.a.createElement(i.View,null,b.a.createElement(i.Text,{style:Jt.title},"Url:"),b.a.createElement(i.TextInput,{ref:e,value:Xt,style:Jt.input}),b.a.createElement(i.View,{style:Jt.row},b.a.createElement(i.Text,{onClick:function(){e.current.getValue().then((function(e){Gt&&1===Gt.readyState&&Gt.close(),(Gt=new WebSocket(e)).onopen=function(){return l("[Opened] ".concat(Gt.url))},Gt.onclose=function(){return l("[Closed] ".concat(Gt.url))},Gt.onerror=function(e){return l("[Error] ".concat(e.reason))},Gt.onmessage=function(e){return l("[Received] ".concat(e.data))}}))},style:Jt.button},"Connect"),b.a.createElement(i.Text,{onClick:function(){return Gt.close()},style:Jt.button},"Disconnect"))),b.a.createElement(i.View,null,b.a.createElement(i.Text,{style:Jt.title},"Message:"),b.a.createElement(i.TextInput,{ref:t,value:Zt,style:Jt.input}),b.a.createElement(i.Text,{onClick:function(){return t.current.getValue().then((function(e){l("[Sent] ".concat(e)),Gt.send(e)}))},style:Jt.button},"Send")),b.a.createElement(i.View,null,b.a.createElement(i.Text,{style:Jt.title},"Log:"),b.a.createElement(i.ScrollView,{style:Jt.fullScreen},o.map((function(e,t){return b.a.createElement(i.Text,{key:t,style:Jt.output},e)})))))};function en(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function tn(e){for(var t=1;t=o||(this.indicator.update(r),this.currentIndex=r)}}},{key:"onScrollBeginDrag",value:function(){this.touchStartOffset=this.scrollOffset,this.doClearTimer()}},{key:"onScrollEndDrag",value:function(){this.doCreateTimer()}},{key:"onLayout",value:function(e){this.width=e.layout.width}},{key:"doSwitchPage",value:function(e){this.scrollview.scrollTo(this.imgWidth*e,0,!0)}},{key:"doCreateTimer",value:function(){var e=this;this.doClearTimer(),this.duration<=0||(this.interval=setInterval((function(){e.doSwitchPage((e.currentIndex+1)%e.itemCount)}),this.duration))}},{key:"doClearTimer",value:function(){this.interval&&clearInterval(this.interval),this.interval=null}},{key:"render",value:function(){for(var e=this,t=this.props.images,n=[],r=0;rr-a?60*r-o:60*n-60*a+30,this.navScrollView.scrollTo({x:e,y:0,animated:!0})}}},{key:"pressNavItem",value:function(e){this.setState({curIndex:e}),this.viewPager&&this.viewPager.setPage(e)}},{key:"renderNav",value:function(){var e=this,t=this.state,n=t.navList,r=t.curIndex;return b.a.createElement(i.View,{style:wn.container},b.a.createElement(i.ScrollView,{style:wn.scroll,horizontal:!0,showsHorizontalScrollIndicator:!1,ref:function(t){e.navScrollView=t}},n.map((function(t,n){return b.a.createElement(i.View,{style:wn.navItem,key:"nav_".concat(t),activeOpacity:.5,onClick:function(){return e.pressNavItem(n)}},b.a.createElement(i.Text,{style:[wn.navItemText,r===n?wn.navItemTextBlue:wn.navItemTextNormal],numberOfLines:1},t))}))))}},{key:"render",value:function(){var e=this,t=this.state.navList;return b.a.createElement(i.View,{style:{flex:1,backgroundColor:"#ffffff"}},this.renderNav(),b.a.createElement(i.ViewPager,{ref:function(t){e.viewPager=t},style:{flex:1},initialPage:0,onPageSelected:function(t){return e.onViewPagerChange(t.position)}},t.map((function(e,t){return n.getPage(e,t)}))))}}],[{key:"getPage",value:function(e,t){switch(t%3){case 0:return ht(e);case 1:return mt(e);case 2:return dt(e);default:return null}}}]),n}(b.a.Component);function Sn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var En=i.Dimensions.get("window").width,Tn=i.StyleSheet.create({setNativePropsDemo:{display:"flex",alignItems:"center",position:"relative"},nativeDemo1Drag:{height:80,width:En,backgroundColor:"#4c9afa",position:"relative",marginTop:10},nativeDemo1Point:{height:80,width:80,color:"#ff0000",backgroundColor:"#ff0000",position:"absolute",left:0},nativeDemo2Drag:{height:80,width:En,backgroundColor:"#4c9afa",position:"relative",marginTop:10},nativeDemo2Point:{height:80,width:80,color:"#ff0000",backgroundColor:"#ff0000",position:"absolute",left:0},splitter:{marginTop:50}}),Cn=function(e){h()(n,e);var t=Sn(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).demon1Point=b.a.createRef(),r.demo1PointDom=null,r.state={demo2Left:0},r.isDemon1Layouted=!1,r.idDemon2Layouted=!1,r}return u()(n,[{key:"componentDidMount",value:function(){}},{key:"onDemon1Layout",value:function(){this.isDemon1Layouted||(this.isDemon1Layouted=!0,this.demo1PointDom=i.UIManagerModule.getElementFromFiberRef(this.demon1Point.current))}},{key:"onTouchDown1",value:function(e){var t=e.page_x,n=t-40;console.log("touchdown x",t,n,En),this.demo1PointDom&&this.demo1PointDom.setNativeProps({style:{left:n}})}},{key:"onTouchMove1",value:function(e){var t=e.page_x,n=t-40;console.log("touchmove x",t,n,En),this.demo1PointDom&&this.demo1PointDom.setNativeProps({style:{left:n}})}},{key:"onTouchDown2",value:function(e){var t=e.page_x,n=t-40;console.log("touchdown x",t,n,En),this.setState({demo2Left:n})}},{key:"onTouchMove2",value:function(e){var t=e.page_x,n=t-40;console.log("touchmove x",t,n,En),this.setState({demo2Left:n})}},{key:"render",value:function(){var e=this,t=this.state.demo2Left;return b.a.createElement(i.View,{style:Tn.setNativePropsDemo},b.a.createElement(i.Text,null,"setNativeProps实现拖动效果"),b.a.createElement(i.View,{style:Tn.nativeDemo1Drag,onTouchDown:function(t){return e.onTouchDown1(t)},onTouchMove:function(t){return e.onTouchMove1(t)}},b.a.createElement(i.View,{onLayout:function(){return e.onDemon1Layout()},style:Tn.nativeDemo1Point,ref:this.demon1Point})),b.a.createElement(i.View,{style:Tn.splitter}),b.a.createElement(i.Text,null,"普通渲染实现拖动效果"),b.a.createElement(i.View,{style:Tn.nativeDemo2Drag,onTouchDown:function(t){return e.onTouchDown2(t)},onTouchMove:function(t){return e.onTouchMove2(t)}},b.a.createElement(i.View,{style:[Tn.nativeDemo2Point,{left:t}]})))}}]),n}(b.a.Component);function Rn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var kn=i.StyleSheet.create({dynamicImportDemo:{marginTop:20,display:"flex",flex:1,alignItems:"center",position:"relative",flexDirection:"column"}}),An=function(e){h()(r,e);var t=Rn(r);function r(e){var n;return c()(this,r),(n=t.call(this,e)).state={AsyncComponentFromLocal:null,AsyncComponentFromHttp:null},n.onAsyncComponentLoad=n.onAsyncComponentLoad.bind(ce()(n)),n}return u()(r,[{key:"onAsyncComponentLoad",value:function(){var e=this;console.log("load async component"),n.e(1).then(n.bind(null,"./src/externals/DyanmicImport/AsyncComponentLocal.jsx")).then((function(t){e.setState({AsyncComponentFromLocal:t.default||t})})).catch((function(e){return console.error("import async local component error",e)})),n.e(0).then(n.bind(null,"./src/externals/DyanmicImport/AsyncComponentHttp.jsx")).then((function(t){e.setState({AsyncComponentFromHttp:t.default||t})})).catch((function(e){return console.error("import async remote component error",e)}))}},{key:"render",value:function(){var e=this.state,t=e.AsyncComponentFromLocal,n=e.AsyncComponentFromHttp;return b.a.createElement(i.View,{style:kn.dynamicImportDemo},b.a.createElement(i.View,{style:{width:130,height:40,textAlign:"center",backgroundColor:"#4c9afa",borderRadius:5},onTouchDown:this.onAsyncComponentLoad},b.a.createElement(i.Text,{style:{height:40,lineHeight:40,textAlign:"center"}},"点我异步加载")),b.a.createElement(i.View,{style:{marginTop:20}},t?b.a.createElement(t,null):null,n?b.a.createElement(n,null):null))}}]),r}(b.a.Component);function Vn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var jn=i.StyleSheet.create({LocalizationDemo:{marginTop:20,display:"flex",flex:1,alignItems:"center",position:"relative",flexDirection:"column"}}),In=function(e){h()(n,e);var t=Vn(n);function n(){return c()(this,n),t.apply(this,arguments)}return u()(n,[{key:"render",value:function(){var e=i.Platform.Localization||{},t=e.country,n=e.language,r=e.direction;return b.a.createElement(i.View,{style:jn.LocalizationDemo},b.a.createElement(i.View,{style:{height:40,textAlign:"center",backgroundColor:"#4c9afa",borderRadius:5},onTouchDown:this.onAsyncComponentLoad},b.a.createElement(i.Text,{style:{color:"white",marginHorizontal:30,height:40,lineHeight:40,textAlign:"center"}},"国际化相关信息:国家 ".concat(t," | 语言 ").concat(n," | 方向 ").concat(1===r?"RTL":"LTR"))))}}]),n}(b.a.Component),On=function(){var e=ie()(ue.a.mark((function e(t){return ue.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,turboPromise(getTurboModule("demoTurbo").nativeWithPromise)(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function Dn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Pn=i.StyleSheet.create({container:{flex:1},cellContentView:{flexDirection:"row",justifyContent:"space-between",backgroundColor:"#ccc",marginBottom:1},funcInfo:{justifyContent:"center",paddingLeft:15,paddingRight:15},actionButton:{backgroundColor:"#4c9afa",color:"#fff",height:44,lineHeight:44,textAlign:"center",width:80,borderRadius:6},resultView:{backgroundColor:"darkseagreen",minHeight:150,padding:15}}),_n=function(e){h()(r,e);var t,n=Dn(r);function r(e){var t;return c()(this,r),(t=n.call(this,e)).state={config:null,result:"",funList:["getString","getNum","getBoolean","getMap","getObject","getArray","nativeWithPromise","getTurboConfig","printTurboConfig","getInfo","setInfo"]},t.onTurboFunc=t.onTurboFunc.bind(ce()(t)),t.getRenderRow=t.getRenderRow.bind(ce()(t)),t.getRowKey=t.getRowKey.bind(ce()(t)),t}return u()(r,[{key:"onTurboFunc",value:(t=ie()(ue.a.mark((function e(t){var n;return ue.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n="","nativeWithPromise"!==t){e.next=7;break}return e.next=4,On("aaa");case 4:n=e.sent,e.next=8;break;case 7:"getTurboConfig"===t?(this.config=getTurboModule("demoTurbo").getTurboConfig(),n="获取到config对象"):"printTurboConfig"===t?(r=this.config,n=getTurboModule("demoTurbo").printTurboConfig(r)):"getInfo"===t?n=this.config.getInfo():"setInfo"===t?(this.config.setInfo("Hello World"),n="设置config信息成功"):n={getString:function(){return e="123",getTurboModule("demoTurbo").getString(e);var e},getNum:function(){return e=1024,getTurboModule("demoTurbo").getNum(e);var e},getBoolean:function(){return e=!0,getTurboModule("demoTurbo").getBoolean(e);var e},getMap:function(){return e=new Map([["a","1"],["b",2]]),getTurboModule("demoTurbo").getMap(e);var e},getObject:function(){return e={c:"3",d:"4"},getTurboModule("demoTurbo").getObject(e);var e},getArray:function(){return e=["a","b","c"],getTurboModule("demoTurbo").getArray(e);var e}}[t]();case 8:this.setState({result:n});case 9:case"end":return e.stop()}var r}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"renderResultView",value:function(){return b.a.createElement(i.View,{style:Pn.resultView},b.a.createElement(i.Text,{style:{backgroundColor:"darkseagreen"}},"".concat(this.state.result)))}},{key:"getRenderRow",value:function(e){var t=this,n=this.state.funList;return b.a.createElement(i.View,{style:Pn.cellContentView},b.a.createElement(i.View,{style:Pn.funcInfo},b.a.createElement(i.Text,{numberofLines:0},"函数名:",n[e])),b.a.createElement(i.Text,{style:Pn.actionButton,onClick:function(){return t.onTurboFunc(n[e])}},"执行"))}},{key:"getRowKey",value:function(e){return this.state.funList[e]}},{key:"render",value:function(){var e=this.state.funList;return b.a.createElement(i.View,{style:Pn.container},this.renderResultView(),b.a.createElement(i.ListView,{numberOfRows:e.length,renderRow:this.getRenderRow,getRowKey:this.getRowKey,style:{flex:1}}))}}]),r}(b.a.Component);function Ln(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Bn(e){for(var t=1;t Develop 菜单进行调试(需要在预置 -> 高级里打开开发者菜单)"),e.push("注意:每次插拔 USB 线后都需要通过 npm run hippy:debug 重启调试服务"));return b.a.createElement(i.ScrollView,{style:Xn.container},e.map((function(e,t){return b.a.createElement(i.Text,{style:Xn.stepText,key:"steps-".concat(t)},e)})),b.a.createElement(i.View,{style:Xn.buttonContainer},b.a.createElement(i.View,{style:Xn.button,onClick:this.clickToDebug},b.a.createElement(i.Text,{style:Xn.buttonText,numberOfLines:1},"点击调试"))))}}]),n}(g.Component);function $n(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var er=i.StyleSheet.create({container:{flex:1}}),tr=function(e){h()(n,e);var t=$n(n);function n(e){var r;c()(this,n),r=t.call(this,e);var o=i.Dimensions.get("window").width,a=i.Dimensions.get("window").height;return r.state={isVertical:o=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;T(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}("object"===t(e)?e.exports:{});try{regeneratorRuntime=r}catch(e){"object"===("undefined"==typeof globalThis?"undefined":t(globalThis))?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}).call(this,n("./node_modules/webpack/buildin/module.js")(e))},"./node_modules/webpack/buildin/global.js":function(e,t,n){e.exports=n("dll-reference hippyReactBase")("./node_modules/webpack/buildin/global.js")},"./node_modules/webpack/buildin/module.js":function(e,t,n){e.exports=n("dll-reference hippyReactBase")("./node_modules/webpack/buildin/module.js")},"./src/main.js":function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"Focusable",(function(){return te})),n.d(r,"Image",(function(){return ae})),n.d(r,"ListView",(function(){return be})),n.d(r,"Modal",(function(){return Ee})),n.d(r,"RefreshWrapper",(function(){return qe})),n.d(r,"PullHeader",(function(){return Ye})),n.d(r,"ScrollView",(function(){return Xe})),n.d(r,"Text",(function(){return tt})),n.d(r,"TextInput",(function(){return ot})),n.d(r,"View",(function(){return lt})),n.d(r,"ViewPager",(function(){return bt})),n.d(r,"WebView",(function(){return wt})),n.d(r,"BoxShadow",(function(){return Tt})),n.d(r,"WaterfallView",(function(){return kt}));var o={};n.r(o),n.d(o,"Animation",(function(){return Ot})),n.d(o,"AsyncStorage",(function(){return _t})),n.d(o,"Clipboard",(function(){return Mt})),n.d(o,"NativeEvent",(function(){return Wt})),n.d(o,"NetInfo",(function(){return Kt})),n.d(o,"TestModule",(function(){return Qt})),n.d(o,"WebSocket",(function(){return en})),n.d(o,"UIManagerModule",(function(){return an}));var a={};n.r(a),n.d(a,"MyView",(function(){return hn})),n.d(a,"Slider",(function(){return vn})),n.d(a,"TabHost",(function(){return Sn})),n.d(a,"SetNativeProps",(function(){return Rn})),n.d(a,"DynamicImport",(function(){return Vn})),n.d(a,"Localization",(function(){return On})),n.d(a,"Turbo",(function(){return Ln}));var i=n("../../packages/hippy-react/dist/index.js"),l=n("./node_modules/@babel/runtime/helpers/classCallCheck.js"),c=n.n(l),s=n("./node_modules/@babel/runtime/helpers/createClass.js"),u=n.n(s),f=n("./node_modules/@babel/runtime/helpers/inherits.js"),h=n.n(f),d=n("./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"),m=n.n(d),p=n("./node_modules/@babel/runtime/helpers/getPrototypeOf.js"),y=n.n(p),g=n("./node_modules/react/index.js"),b=n.n(g),v=n("./node_modules/@babel/runtime/helpers/toConsumableArray.js"),w=n.n(v),x=n("./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js");n("./node_modules/prop-types/index.js"),n("./node_modules/@babel/runtime/helpers/typeof.js");function S(){return(S=Object.assign||function(e){for(var t=1;t=0;u--){var f=o[u];"."===f?E(o,u):".."===f?(E(o,u),s++):s&&(E(o,u),s--)}if(!l)for(;s--;s)o.unshift("..");!l||""===o[0]||o[0]&&T(o[0])||o.unshift("");var h=o.join("/");return n&&"/"!==h.substr(-1)&&(h+="/"),h};var R="Invariant failed";function k(e,t){if(!e)throw new Error(R)}function A(e){var t=e.pathname,n=e.search,r=e.hash,o=t||"/";return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}function V(e,t,n,r){var o;"string"==typeof e?(o=function(e){var t=e||"/",n="",r="",o=t.indexOf("#");-1!==o&&(r=t.substr(o),t=t.substr(0,o));var a=t.indexOf("?");return-1!==a&&(n=t.substr(a),t=t.substr(0,a)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e)).state=t:(void 0===(o=S({},e)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==t&&void 0===o.state&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(e){throw e instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):e}return n&&(o.key=n),r?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=C(o.pathname,r.pathname)):o.pathname=r.pathname:o.pathname||(o.pathname="/"),o}function j(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,o){if(null!=e){var a="function"==typeof e?e(t,n):e;"string"==typeof a?"function"==typeof r?r(a,o):o(!0):o(!1!==a)}else o(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;rt?n.splice(t,n.length-t,r):n.push(r),u({action:"PUSH",location:r,index:t,entries:n})}}))},replace:function(e,t){var r=V(e,t,f(),y.location);s.confirmTransitionTo(r,"REPLACE",n,(function(e){e&&(y.entries[y.index]=r,u({action:"REPLACE",location:r}))}))},go:p,goBack:function(){p(-1)},goForward:function(){p(1)},canGo:function(e){var t=y.index+e;return t>=0&&t=0||(o[n]=e[n]);return o}var B=n("./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js"),M=n.n(B),z=function(e){var t=Object(P.a)();return t.displayName=e,t}("Router"),F=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={location:t.history.location},n._isMounted=!1,n._pendingLocation=null,t.staticContext||(n.unlisten=t.history.listen((function(e){n._isMounted?n.setState({location:e}):n._pendingLocation=e}))),n}Object(x.a)(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var n=t.prototype;return n.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},n.componentWillUnmount=function(){this.unlisten&&this.unlisten()},n.render=function(){return b.a.createElement(z.Provider,{children:this.props.children||null,value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}})},t}(b.a.Component);var W=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o=100?t([]):t(de)}),1e3)}))}},{key:"render",value:function(){var e=this,t=this.state.dataSource;return b.a.createElement(i.ListView,{onClick:function(){console.log("click listview")},bounces:!0,overScrollEnabled:!0,horizontal:void 0,style:{flex:1,backgroundColor:"#ffffff"},numberOfRows:t.length,renderRow:this.getRenderRow,onEndReached:this.onEndReached,getRowType:this.getRowType,onDelete:this.onDelete,delText:this.delText,editable:!0,getRowKey:this.getRowKey,initialListSize:15,rowShouldSticky:function(e){return 2===e},onAppear:function(t){return e.onAppear(t)},onDisappear:function(t){return e.onDisappear(t)},onWillAppear:function(t){return e.onWillAppear(t)},onWillDisappear:function(t){return e.onWillDisappear(t)}})}}]),r}(b.a.Component);function ve(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var we="#4c9afa",xe="#f44837",Se="#fff",Te=i.StyleSheet.create({container:{flex:1,flexDirection:"row",justifyContent:"center"},buttonView:{borderColor:we,borderWidth:2,borderRadius:8,justifyContent:"center",alignItems:"center",width:250,height:50,marginTop:30},buttonText:{fontSize:20,color:we,textAlign:"center",textAlignVertical:"center"}}),Ee=function(e){h()(n,e);var t=ve(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={visible:!1,press:!1},r.show=r.show.bind(se()(r)),r.hide=r.hide.bind(se()(r)),r}return u()(n,[{key:"feedback",value:function(e){this.setState({press:"in"===e})}},{key:"show",value:function(){this.setState({visible:!0})}},{key:"hide",value:function(){this.setState({visible:!1})}},{key:"render",value:function(){var e=this,t=this.state,n=t.press,r=t.visible;return b.a.createElement(i.ScrollView,null,b.a.createElement(i.View,{style:Te.container},b.a.createElement(i.View,{onPressIn:function(){return e.feedback("in")},onPressOut:function(){return e.feedback.bind("out")},onClick:this.show,style:[Te.buttonView,{borderColor:we,opacity:n?.5:1}]},b.a.createElement(i.Text,{style:[Te.buttonText,{color:we}]},"点击弹出浮层"))),b.a.createElement(i.Modal,{transparent:!0,animationType:"slide_fade",visible:r,onRequestClose:function(){},supportedOrientations:["portrait"]},b.a.createElement(i.View,{style:{flex:1,flexDirection:"row",justifyContent:"center"}},b.a.createElement(i.View,{onClick:this.hide,style:{width:200,height:200,backgroundColor:xe,marginTop:300,flexDirection:"row",justifyContent:"center"}},b.a.createElement(i.Text,{style:{color:Se,fontSize:22,marginTop:80}},"点击关闭浮层")))))}}]),n}(b.a.Component),Ce="http://res.imtt.qq.com/tps/expo-listview-1.jpg",Re={style:1,itemBean:{title:"非洲总统出行真大牌,美制武装直升机和中国潜艇为其保驾",picList:[Ce,Ce,Ce],subInfo:["三图评论","11评"]}},ke={style:2,itemBean:{title:"彼得·泰尔:认知未来是投资人的谋生之道",picUrl:"http://res.imtt.qq.com/tps/expo-listview-2.jpg",subInfo:["左文右图"]}},Ae={style:5,itemBean:{title:"愤怒!美官员扬言:“不让中国拿走南海的岛屿,南海岛礁不属于中国”?",picUrl:"http://res.imtt.qq.com/tps/expo-listview-3.jpg",subInfo:["六眼神魔 5234播放"]}},Ve=[Ae,Re,ke,Re,ke,Re,ke,Ae,Re],je={getScreenWidth:function(){var e=i.Dimensions.get("screen").width,t=i.Dimensions.get("screen").height,n=e>t?t:e;return Math.floor(n)},uniqueArray:function(e){for(var t=[],n=0;n=812&&i.PixelRatio.get()>=2&&(e=!0),e}},Ie=(je.getScreenWidth()-24-12)/3,Oe=Math.floor(Ie/1.35),Pe=i.StyleSheet.create({imageContainer:{flexDirection:"row",justifyContent:"center",height:Oe,marginTop:8},normalText:{fontSize:11,color:"#aaaaaa",alignSelf:"center"},image:{width:Ie,height:Oe},title:{fontSize:"android"===i.Platform.OS?17:18,lineHeight:24,color:"#242424"},tagLine:{marginTop:8,height:20,flexDirection:"row",justifyContent:"flex-start"}});function De(e){var t=e.itemBean,n=t.title,r=t.picList,o=e.itemBean.subInfo,a=null;if(o&&o.length){var l=(o=je.uniqueArray(o)).join(" ");a=b.a.createElement(i.Text,{style:Pe.normalText,numberOfLines:1},l)}return b.a.createElement(i.View,e,b.a.createElement(i.Text,{style:[Pe.title],numberOfLines:2,enableScale:!0},n),b.a.createElement(i.View,{style:Pe.imageContainer},b.a.createElement(i.Image,{style:Pe.image,source:{uri:r[0]},resizeMode:i.Image.resizeMode.cover}),b.a.createElement(i.Image,{style:[Pe.image,{marginLeft:6,marginRight:6}],source:{uri:r[1]},resizeMode:i.Image.resizeMode.cover}),b.a.createElement(i.Image,{style:Pe.image,source:{uri:r[2]},resizeMode:i.Image.resizeMode.cover})),a?b.a.createElement(i.View,{style:Pe.tagLine},a):null)}var _e=je.getScreenWidth()-24,Le=Math.floor(_e-12)/3,Be=Math.floor(Le/1.35),Me=i.StyleSheet.create({container:{flexDirection:"row",justifyContent:"space-between",height:Be},leftContainer:{flex:1,flexDirection:"column",justifyContent:"center",marginRight:8},imageContainer:{width:Le,height:Be},image:{width:Le,height:Be},title:{fontSize:"android"===i.Platform.OS?17:18,lineHeight:24},tagLine:{marginTop:8,height:20,flexDirection:"row",justifyContent:"flex-start"},normalText:{fontSize:11,color:"#aaaaaa",alignSelf:"center"}});function ze(e){if("undefined"===e)return null;var t=e.itemBean;if(!t)return null;var n=null,r=t.title,o=t.picUrl,a=t.subInfo;if(a&&a.length){var l=(a=je.uniqueArray(a)).join(" ");n=b.a.createElement(i.Text,{style:Me.normalText,numberOfLines:1},l)}return b.a.createElement(i.View,{style:Me.container},b.a.createElement(i.View,{style:Me.leftContainer},b.a.createElement(i.Text,{style:Me.title,numberOfLines:2,enableScale:!0},r),n?b.a.createElement(i.View,{style:Me.tagLine},n):null),b.a.createElement(i.View,{style:Me.imageContainer},b.a.createElement(i.Image,{resizeMode:i.Image.resizeMode.cover,style:Me.image,source:{uri:o}})))}var Fe=je.getScreenWidth()-24,We=Math.floor(188*Fe/336),He=i.StyleSheet.create({text:{fontSize:"android"===i.Platform.OS?17:18,lineHeight:24,color:"#242424"},playerView:{marginTop:8,alignItems:"center",width:Fe,height:We,alignSelf:"center"},image:{width:Fe,height:We},normalText:{fontSize:11,color:"#aaaaaa",alignSelf:"center"},tagLine:{marginTop:8,flexDirection:"row",justifyContent:"space-between",alignItems:"center"}});function Ne(e){if("undefined"===e)return null;var t=e.itemBean;if(!t)return null;var n=t.title,r=t.picUrl,o=t.subInfo,a=null;if(o&&o.length){var l=(o=je.uniqueArray(o)).join(" ");a=b.a.createElement(i.Text,{style:He.normalText,numberOfLines:1},l)}return b.a.createElement(i.View,null,b.a.createElement(i.Text,{style:He.text,numberOfLines:2,enableScale:!0},n),b.a.createElement(i.View,{style:He.playerView},b.a.createElement(i.Image,{style:He.image,source:{uri:r},resizeMode:i.Image.resizeMode.cover})),a?b.a.createElement(i.View,{style:He.tagLine},a):null)}function Ke(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Ue=i.StyleSheet.create({container:{backgroundColor:"#ffffff"},itemContainer:{padding:12},spliter:{marginLeft:12,marginRight:12,height:.5,backgroundColor:"#e5e5e5"},loading:{fontSize:11,color:"#aaaaaa",alignSelf:"center"}}),qe=function(e){h()(o,e);var t,n,r=Ke(o);function o(e){var t;return c()(this,o),(t=r.call(this,e)).state={dataSource:[],loadingState:"正在加载..."},t.fetchTimes=0,t.mockFetchData=t.mockFetchData.bind(se()(t)),t.onRefresh=t.onRefresh.bind(se()(t)),t.getRefresh=t.getRefresh.bind(se()(t)),t.getRenderRow=t.getRenderRow.bind(se()(t)),t.onEndReached=t.onEndReached.bind(se()(t)),t.getRowType=t.getRowType.bind(se()(t)),t.getRowKey=t.getRowKey.bind(se()(t)),t}return u()(o,[{key:"componentDidMount",value:(n=le()(fe.a.mark((function e(){var t;return fe.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.mockFetchData();case 2:t=e.sent,this.setState({dataSource:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"onEndReached",value:(t=le()(fe.a.mark((function e(){var t,n,r,o,a;return fe.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.state,n=t.dataSource,!t.fetchingDataFlag){e.next=3;break}return e.abrupt("return");case 3:return this.setState({fetchingDataFlag:!0,dataSource:n.concat([{style:100}])}),e.next=6,this.mockFetchData();case 6:r=e.sent,(o=n[n.length-1])&&100===o.style&&n.pop(),a=n.concat(r),this.setState({dataSource:a});case 11:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"onRefresh",value:function(){var e=this;setTimeout(le()(fe.a.mark((function t(){var n;return fe.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.mockFetchData();case 2:n=t.sent,e.setState({dataSource:n}),e.refresh.refreshComplected();case 5:case"end":return t.stop()}}),t)}))),1e3)}},{key:"onClickItem",value:function(e){console.log("item: ".concat(e," is clicked.."))}},{key:"getRenderRow",value:function(e){var t=this,n=this.state,r=n.dataSource,o=n.loadingState,a=null,l=r[e],c=r.length===e+1;switch(l.style){case 1:a=b.a.createElement(De,{itemBean:l.itemBean,onClick:function(){return t.onClickItem(e)}});break;case 2:a=b.a.createElement(ze,{itemBean:l.itemBean,onClick:function(){return t.onClickItem(e)}});break;case 5:a=b.a.createElement(Ne,{itemBean:l.itemBean,onClick:function(){return t.onClickItem(e)}});break;case 100:a=b.a.createElement(i.Text,{style:Ue.loading},o)}return b.a.createElement(i.View,{style:Ue.container},b.a.createElement(i.View,{style:Ue.itemContainer},a),c?null:b.a.createElement(i.View,{style:Ue.spliter}))}},{key:"getRowType",value:function(e){return this.state.dataSource[e].style}},{key:"getRowKey",value:function(e){return"row-".concat(e)}},{key:"getRefresh",value:function(){return b.a.createElement(i.View,{style:{flex:1,height:30}},b.a.createElement(i.Text,{style:{flex:1,textAlign:"center"}},"下拉刷新中..."))}},{key:"mockFetchData",value:function(){var e=this;return new Promise((function(t){setTimeout((function(){return e.setState({fetchingDataFlag:!1}),e.fetchTimes+=1,e.fetchTimes>=50?t([]):t(Ve)}),1e3)}))}},{key:"render",value:function(){var e=this,t=this.state.dataSource;return b.a.createElement(i.RefreshWrapper,{ref:function(t){e.refresh=t},style:{flex:1},onRefresh:this.onRefresh,bounceTime:100,getRefresh:this.getRefresh},b.a.createElement(i.ListView,{style:{flex:1,backgroundColor:"#ffffff"},numberOfRows:t.length,renderRow:this.getRenderRow,onEndReached:this.onEndReached,getRowType:this.getRowType,getRowKey:this.getRowKey}))}}]),o}(b.a.Component);function Ge(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Qe=i.StyleSheet.create({container:{backgroundColor:"#ffffff"},itemContainer:{padding:12},splitter:{marginLeft:12,marginRight:12,height:.5,backgroundColor:"#e5e5e5"},loading:{fontSize:11,color:"#aaaaaa",alignSelf:"center"},pullContainer:{height:60,backgroundColor:"green"},pullContent:{lineHeight:60,color:"white",height:60,textAlign:"center"}}),Ye=function(e){h()(a,e);var t,n,r,o=Ge(a);function a(e){var t;return c()(this,a),(t=o.call(this,e)).state={dataSource:[],pullingText:"继续下拉触发刷新",loadingState:"正在加载..."},t.fetchTimes=0,t.mockFetchData=t.mockFetchData.bind(se()(t)),t.renderRow=t.renderRow.bind(se()(t)),t.getRowType=t.getRowType.bind(se()(t)),t.getRowKey=t.getRowKey.bind(se()(t)),t.renderPullHeader=t.renderPullHeader.bind(se()(t)),t.onEndReached=t.onEndReached.bind(se()(t)),t.onHeaderReleased=t.onHeaderReleased.bind(se()(t)),t.onHeaderPulling=t.onHeaderPulling.bind(se()(t)),t}return u()(a,[{key:"componentDidMount",value:(r=le()(fe.a.mark((function e(){var t;return fe.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.mockFetchData();case 2:t=e.sent,this.setState({dataSource:t}),this.listView.collapsePullHeader();case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"onEndReached",value:(n=le()(fe.a.mark((function e(){var t,n,r,o;return fe.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.state.dataSource,!this.loadMoreDataFlag){e.next=3;break}return e.abrupt("return");case 3:return this.loadMoreDataFlag=!0,this.setState({dataSource:t.concat([{style:100}])}),n=[],e.prev=6,e.next=9,this.mockFetchData();case 9:n=e.sent,e.next=14;break;case 12:e.prev=12,e.t0=e.catch(6);case 14:(r=t[t.length-1])&&100===r.style&&t.pop(),o=t.concat(n),this.loadMoreDataFlag=!1,this.setState({dataSource:o});case 19:case"end":return e.stop()}}),e,this,[[6,12]])}))),function(){return n.apply(this,arguments)})},{key:"onHeaderReleased",value:(t=le()(fe.a.mark((function e(){var t,n=this;return fe.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.fetchingDataFlag){e.next=2;break}return e.abrupt("return");case 2:return this.fetchingDataFlag=!0,console.log("onHeaderReleased"),this.setState({pullingText:"刷新数据中,请稍等,2秒后自动收起"}),t=[],e.prev=6,e.next=9,this.mockFetchData();case 9:t=e.sent,e.next=14;break;case 12:e.prev=12,e.t0=e.catch(6);case 14:this.fetchingDataFlag=!1,this.setState({dataSource:t},(function(){n.listView.collapsePullHeader(),n.fetchTimes=0}));case 16:case"end":return e.stop()}}),e,this,[[6,12]])}))),function(){return t.apply(this,arguments)})},{key:"onHeaderPulling",value:function(e){this.fetchingDataFlag||(console.log("onHeaderPulling",e.contentOffset),e.contentOffset>Qe.pullContent.height?this.setState({pullingText:"松手,即可触发刷新"}):this.setState({pullingText:"继续下拉,触发刷新"}))}},{key:"onClickItem",value:function(e){console.log("item: ".concat(e," is clicked.."))}},{key:"getRowType",value:function(e){return this.state.dataSource[e].style}},{key:"getRowKey",value:function(e){return"row-".concat(e)}},{key:"mockFetchData",value:function(){var e=this;return new Promise((function(t){setTimeout((function(){e.fetchTimes+=1;var n=[];return e.fetchTimes<50&&(n=Ve),t(n)}),2e3)}))}},{key:"renderPullHeader",value:function(){var e=this.state.pullingText;return b.a.createElement(i.View,{style:Qe.pullContainer},b.a.createElement(i.Text,{style:Qe.pullContent},e))}},{key:"renderRow",value:function(e){var t=this,n=this.state,r=n.dataSource,o=n.loadingState,a=null,l=r[e],c=r.length===e+1;switch(l.style){case 1:a=b.a.createElement(De,{itemBean:l.itemBean,onClick:function(){return t.onClickItem(e)}});break;case 2:a=b.a.createElement(ze,{itemBean:l.itemBean,onClick:function(){return t.onClickItem(e)}});break;case 5:a=b.a.createElement(Ne,{itemBean:l.itemBean,onClick:function(){return t.onClickItem(e)}});break;case 100:a=b.a.createElement(i.Text,{style:Qe.loading},o)}return b.a.createElement(i.View,{style:Qe.container},b.a.createElement(i.View,{style:Qe.itemContainer},a),c?null:b.a.createElement(i.View,{style:Qe.splitter}))}},{key:"render",value:function(){var e=this,t=this.state.dataSource;return b.a.createElement(i.ListView,{ref:function(t){e.listView=t},style:{flex:1,backgroundColor:"#ffffff"},numberOfRows:t.length,getRowType:this.getRowType,getRowKey:this.getRowKey,renderRow:this.renderRow,renderPullHeader:this.renderPullHeader,onEndReached:this.onEndReached,onHeaderReleased:this.onHeaderReleased,onHeaderPulling:this.onHeaderPulling})}}]),a}(b.a.Component),Je=i.StyleSheet.create({itemStyle:{width:100,height:100,lineHeight:100,borderWidth:1,borderColor:"#4c9afa",fontSize:80,margin:20,color:"#4c9afa",textAlign:"center"},verticalScrollView:{height:300,width:140,margin:20,borderColor:"#eee",borderWidth:1},itemTitle:{alignItems:"flex-start",justifyContent:"center",height:40,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10}});function Xe(){return b.a.createElement(i.ScrollView,null,b.a.createElement(i.View,{style:Je.itemTitle},b.a.createElement(i.Text,null,"Horizontal ScrollView")),b.a.createElement(i.View,null,b.a.createElement(i.ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,bounces:!0},b.a.createElement(i.Text,{style:Je.itemStyle},"A"),b.a.createElement(i.Text,{style:Je.itemStyle},"B"),b.a.createElement(i.Text,{style:Je.itemStyle},"C"),b.a.createElement(i.Text,{style:Je.itemStyle},"D"),b.a.createElement(i.Text,{style:Je.itemStyle},"E"),b.a.createElement(i.Text,{style:Je.itemStyle},"F"),b.a.createElement(i.Text,{style:Je.itemStyle},"A"))),b.a.createElement(i.View,{style:Je.itemTitle},b.a.createElement(i.Text,null,"Vertical ScrollView")),b.a.createElement(i.ScrollView,{bounces:!0,horizontal:!1,style:Je.verticalScrollView,showsVerticalScrollIndicator:!1},b.a.createElement(i.Text,{style:Je.itemStyle},"A"),b.a.createElement(i.Text,{style:Je.itemStyle},"B"),b.a.createElement(i.Text,{style:Je.itemStyle},"C"),b.a.createElement(i.Text,{style:Je.itemStyle},"D"),b.a.createElement(i.Text,{style:Je.itemStyle},"E"),b.a.createElement(i.Text,{style:Je.itemStyle},"F"),b.a.createElement(i.Text,{style:Je.itemStyle},"A")))}function Ze(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var $e=i.StyleSheet.create({itemTitle:{alignItems:"flex-start",justifyContent:"center",height:40,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10},itemContent:{alignItems:"flex-start",justifyContent:"center",height:100,borderWidth:1,borderRadius:2,borderColor:"#e0e0e0",backgroundColor:"#ffffff",padding:10},normalText:{fontSize:14,lineHeight:18,color:"black"},button:{width:100,height:24,borderColor:"blue",borderWidth:1},buttonText:{width:100,lineHeight:24,textAlign:"center"},customFont:{color:"#0052d9",fontSize:32,fontFamily:"TTTGB"}}),et=0,tt=function(e){h()(n,e);var t=Ze(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={fontSize:16,textShadowColor:"grey",textShadowOffset:{x:1,y:1}},r.incrementFontSize=r.incrementFontSize.bind(se()(r)),r.decrementFontSize=r.decrementFontSize.bind(se()(r)),r.androidNestedTextWrapperStyle={height:100,lineHeight:100},r}return u()(n,[{key:"incrementFontSize",value:function(){var e=this.state.fontSize;24!==e&&this.setState({fontSize:e+1})}},{key:"decrementFontSize",value:function(){var e=this.state.fontSize;6!==e&&this.setState({fontSize:e-1})}},{key:"render",value:function(){var e=this,t=this.state,n=t.fontSize,r=t.textShadowColor,o=t.textShadowOffset,a=function(e){return b.a.createElement(i.View,{style:$e.itemTitle},b.a.createElement(i.Text,{style:!0},e))};return b.a.createElement(i.ScrollView,{style:{padding:10}},a("shadow"),b.a.createElement(i.View,{style:[$e.itemContent],onClick:function(){var t="red",n={x:10,y:1};et%2==1&&(t="grey",n={x:1,y:1}),et+=1,e.setState({textShadowColor:t,textShadowOffset:n})}},b.a.createElement(i.Text,{style:[$e.normalText,{color:"#242424",textShadowOffset:o,textShadowRadius:3,textShadowColor:r}]},"Text shadow is grey with radius 3 and offset 1")),a("color"),b.a.createElement(i.View,{style:[$e.itemContent]},b.a.createElement(i.Text,{style:[$e.normalText,{color:"#242424"}]},"Text color is black"),b.a.createElement(i.Text,{style:[$e.normalText,{color:"blue"}]},"Text color is blue"),b.a.createElement(i.Text,{style:[$e.normalText,{color:"rgb(228,61,36)"}]},"This is red")),a("fontSize"),b.a.createElement(i.View,{style:$e.itemContent},b.a.createElement(i.Text,{style:[$e.normalText,{fontSize:n}]},"Text fontSize is ".concat(n)),b.a.createElement(i.View,{style:$e.button,onClick:this.incrementFontSize},b.a.createElement(i.Text,{style:$e.buttonText},"放大字体")),b.a.createElement(i.View,{style:$e.button,onClick:this.decrementFontSize},b.a.createElement(i.Text,{style:$e.buttonText},"缩小字体"))),a("fontStyle"),b.a.createElement(i.View,{style:$e.itemContent},b.a.createElement(i.Text,{style:[$e.normalText,{fontStyle:"normal"}]},"Text fontStyle is normal"),b.a.createElement(i.Text,{style:[$e.normalText,{fontStyle:"italic"}]},"Text fontStyle is italic")),a("numberOfLines"),b.a.createElement(i.View,{style:$e.itemContent},b.a.createElement(i.Text,{numberOfLines:1,style:$e.normalText},"just one line just one line just one line just one line just one line just one line just one line just one line"),b.a.createElement(i.Text,{numberOfLines:2,style:$e.normalText},"just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines just two lines")),a("textDecoration"),b.a.createElement(i.View,{style:$e.itemContent},b.a.createElement(i.Text,{numberOfLines:1,style:[$e.normalText,{textDecorationLine:"underline",textDecorationStyle:"dotted"}]},"underline"),b.a.createElement(i.Text,{numberOfLines:1,style:[$e.normalText,{textDecorationLine:"line-through",textDecorationColor:"red"}]},"line-through")),a("Nest Text"),b.a.createElement(i.View,{style:$e.itemContent},b.a.createElement(i.Text,{numberOfLines:3},b.a.createElement(i.Text,{numberOfLines:3,style:[$e.normalText,{color:"#4c9afa"}]},"#SpiderMan#"),b.a.createElement(i.Text,{numberOfLines:3,style:$e.normalText},"Hello world, I am a spider man and I have five friends in other universe."))),a("Custom font"),b.a.createElement(i.View,{style:$e.itemContent},b.a.createElement(i.Text,{numberOfLines:1,style:$e.customFont},"Hippy 跨端框架")),a("Text Nested"),b.a.createElement(i.View,{style:$e.itemContent},b.a.createElement(i.Text,{style:"android"===i.Platform.OS?this.androidNestedTextWrapperStyle:{}},b.a.createElement(i.Text,{numberOfLines:1,style:$e.normalText},"后面有张图片"),b.a.createElement(i.Image,{style:{width:70,height:35},source:{uri:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAtCAMAAABmgJ64AAAAOVBMVEX/Rx8AAAD/QiL/Tif/QyH/RR//QiH/QiP/RCD/QSL/Qxz/QyH/QiL/QiD/QyL/QiL/QiH/QyH/QiLwirLUAAAAEnRSTlMZAF4OTC7DrWzjI4iietrRk0EEv/0YAAAB0UlEQVRYw72Y0Y6sIAxAKwUFlFH7/x97izNXF2lN1pU5D800jD2hJAJCdwYZuAUyVbmToKh903IhQHgErAVH+ccV0KI+G2oBPMxJgPA4WAigAT8F0IRDgNAE3ARyfeMFDGSc3YHVFkTBAHKDAgkEyHjacae/GTjxFqAo8NbakXrL9DRy9B+BCQwRcXR9OBKmEuAmAFFgcy0agBnIc1xZsMPOI5loAoUsQFmQjDEL9YbpaeGYBMGRKKAuqFEFL/JXApCw/zFEZk9qgbLGBx0gXLISxT25IUBREEgh1II1fph/IViGnZnCcDDVAgfgVg6gCy6ZaClySbDQpAl04vCGaB4+xGcFRK8CLvW0IBb5bQGqAlNwU4C6oEIVTLTcmoEr0AWcpKsZ/H0NAtkLQffnFjkOqiC/TTWBL9AFCwXQBHgI7rXImMgjCZwFa50s6DRBXyALmIECuMASiWNPFgRTgSJwM+XW8PDCmbwndzdaNL8FMYXPNjASDVChnIvWlBI/MKadPV952HszbmXtRERhhQ0vGFA52SVSSVt7MjHvxfRK8cdTpqovn02dUcltMrwiKf+wQ1FxXKCk9en6e/eDNnP44h2thQEb35O/etNv/q3iHza+KuhqqhZAAAAAAElFTkSuQmCC"}}),b.a.createElement(i.Text,{numberOfLines:1,style:$e.customFont},"前面有张图片"))))}}]),n}(b.a.Component);function nt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var rt=i.StyleSheet.create({container_style:{padding:10},input_style:{width:300,marginVertical:10,placeholderTextColor:"#aaaaaa",fontSize:16,color:"#242424",height:30,lineHeight:30},itemTitle:{alignItems:"flex-start",justifyContent:"center",height:40,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10},button:{width:200,borderColor:"#4c9afa",borderWidth:1,marginTop:5,marginBottom:5}}),ot=function(e){h()(n,e);var t=nt(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={textContent:""},r.changeInputContent=r.changeInputContent.bind(se()(r)),r.focus=r.focus.bind(se()(r)),r.blur=r.blur.bind(se()(r)),r}return u()(n,[{key:"changeInputContent",value:function(){this.setState({textContent:"当前时间毫秒:".concat(Date.now())})}},{key:"focus",value:function(){this.input.focus()}},{key:"blur",value:function(){this.input.blur()}},{key:"render",value:function(){var e=this,t=this.state.textContent,n=function(e){return b.a.createElement(i.View,{style:rt.itemTitle},b.a.createElement(i.Text,null,e))};return b.a.createElement(i.ScrollView,{style:rt.container_style},n("text"),b.a.createElement(i.TextInput,{ref:function(t){e.input=t},style:rt.input_style,placeholder:"text",defaultValue:t}),b.a.createElement(i.View,{style:rt.button,onClick:this.changeInputContent},b.a.createElement(i.Text,null,"点击改变输入框内容")),b.a.createElement(i.View,{style:rt.button,onClick:this.focus},b.a.createElement(i.Text,null,"Focus")),b.a.createElement(i.View,{style:rt.button,onClick:this.blur},b.a.createElement(i.Text,null,"Blur")),n("numeric"),b.a.createElement(i.TextInput,{style:rt.input_style,keyboardType:"numeric",placeholder:"numeric"}),n("phone-pad"),b.a.createElement(i.TextInput,{style:rt.input_style,keyboardType:"phone-pad",placeholder:"phone-pad"}),n("password"),b.a.createElement(i.TextInput,{style:rt.input_style,keyboardType:"password",placeholder:"Password",multiline:!1}),n("maxLength"),b.a.createElement(i.TextInput,{style:rt.input_style,placeholder:"maxLength=5",maxLength:5}))}}]),n}(g.Component),at=n.p+"assets/defaultSource.jpg",it=i.StyleSheet.create({itemTitle:{alignItems:"flex-start",justifyContent:"center",height:40,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10},rectangle:{width:160,height:80,marginVertical:10},bigRectangle:{width:200,height:100,borderColor:"#eee",borderWidth:1,padding:10,marginVertical:10},smallRectangle:{width:40,height:40,borderRadius:10}});function lt(){var e=function(e){return b.a.createElement(i.View,{style:it.itemTitle},b.a.createElement(i.Text,null,e))};return b.a.createElement(i.ScrollView,{style:{padding:10}},e("backgroundColor"),b.a.createElement(i.View,{style:[it.rectangle,{backgroundColor:"#4c9afa"}]}),e("backgroundImage"),b.a.createElement(i.View,{style:[it.rectangle,{alignItems:"center",justifyContent:"center",marginTop:20,backgroundImage:at}],accessible:!0,accessibilityLabel:"背景图",accessibilityRole:"image",accessibilityState:{disabled:!1,selected:!0,checked:!1,expanded:!1,busy:!0},accessibilityValue:{min:1,max:10,now:5,text:"middle"}},b.a.createElement(i.Text,{style:{color:"white"}},"背景图")),e("backgroundImage linear-gradient"),b.a.createElement(i.View,{style:[it.rectangle,{alignItems:"center",justifyContent:"center",marginTop:20,borderWidth:2,borderColor:"black",borderRadius:2,backgroundImage:"linear-gradient(30deg, blue 10%, yellow 40%, red 50%);"}]},b.a.createElement(i.Text,{style:{color:"white"}},"渐变色")),e("border props"),b.a.createElement(i.View,{style:[it.rectangle,{borderColor:"#242424",borderRadius:4,borderWidth:1}]}),e("flex props"),b.a.createElement(i.View,{style:[it.bigRectangle,{flexDirection:"row",alignItems:"center",justifyContent:"space-between"}]},b.a.createElement(i.View,{style:[it.smallRectangle,{backgroundColor:"yellow"}]}),b.a.createElement(i.View,{style:[it.smallRectangle,{backgroundColor:"blue"}]}),b.a.createElement(i.View,{style:[it.smallRectangle,{backgroundColor:"green"}]})))}var ct=i.StyleSheet.create({pageContainer:{alignItems:"center",justifyContent:"center",flex:1,paddingTop:20},mainRec:{backgroundColor:"#4c9afaAA",width:256,height:48,marginBottom:10,marginTop:156},title:{verticalAlign:"middle",lineHeight:48,height:48,fontSize:16,color:"#f44837",alignSelf:"center"},shapeBase:{width:128,height:128,backgroundColor:"#4c9afa"},square:{},circle:{borderRadius:64},triangle:{borderTopWidth:0,borderRightWidth:70,borderBottomWidth:128,borderLeftWidth:70,borderTopColor:"transparent",borderRightColor:"transparent",borderLeftColor:"transparent",borderBottomColor:"#4c9afa",backgroundColor:"transparent",width:140}}),st="SquarePagerView",ut="TrianglePagerView",ft="CirclePagerView";function ht(e,t){var n=function(t){return b.a.createElement(i.View,{style:ct.pageContainer,key:t},b.a.createElement(i.View,{style:[ct.shapeBase,e]}),b.a.createElement(i.View,{style:ct.mainRec},t?b.a.createElement(i.Text,{style:ct.title},t):null))};return n.displayName=t,n}var dt=ht(ct.square,st),mt=ht(ct.triangle,ut),pt=ht(ct.circle,ft);function yt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var gt=i.StyleSheet.create({dotContainer:{position:"absolute",bottom:10,left:0,right:0,flexDirection:"row",alignItems:"center",justifyContent:"center"},dot:{width:6,height:6,borderRadius:3,margin:3,backgroundColor:"#BBBBBB"},selectDot:{backgroundColor:"#000000"},container:{height:500},buttonContainer:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12},button:{width:120,height:36,backgroundColor:"#4c9afa",borderRadius:18,alignItems:"center",justifyContent:"center"},buttonText:{fontSize:16,color:"#fff"}}),bt=function(e){h()(n,e);var t=yt(n);function n(e){var r;return c()(this,n),r=t.call(this,e),$()(se()(r),"state",{selectedIndex:0}),r.onPageSelected=r.onPageSelected.bind(se()(r)),r}return u()(n,[{key:"onPageSelected",value:function(e){console.log("=====onPageSelected",e.position),this.setState({selectedIndex:e.position})}},{key:"onPageScrollStateChanged",value:function(e){console.log("=====onPageScrollStateChanged===",e)}},{key:"onPageScroll",value:function(e){var t=e.offset,n=e.position;console.log("onPageScroll",t,n)}},{key:"render",value:function(){var e=this,t=this.state.selectedIndex;return b.a.createElement(i.View,{style:{flex:1,backgroundColor:"#ffffff"}},b.a.createElement(i.View,{style:gt.buttonContainer},b.a.createElement(i.View,{style:gt.button,onClick:function(){e.viewpager.setPage(2)}},b.a.createElement(i.Text,{style:gt.buttonText},"动效滑到第3页")),b.a.createElement(i.View,{style:gt.button,onClick:function(){return e.viewpager.setPageWithoutAnimation(0)}},b.a.createElement(i.Text,{style:gt.buttonText},"直接滑到第1页"))),b.a.createElement(i.ViewPager,{ref:function(t){e.viewpager=t},style:gt.container,initialPage:0,keyboardDismissMode:"none",scrollEnabled:!0,onPageSelected:this.onPageSelected,onPageScroll:this.onPageScroll},[dt(),mt(),pt()]),b.a.createElement(i.View,{style:gt.dotContainer},new Array(3).fill(0).map((function(e,n){var r=n===t;return b.a.createElement(i.View,{style:[gt.dot,r?gt.selectDot:null]})}))))}}]),n}(b.a.Component),vt=i.StyleSheet.create({itemTitle:{alignItems:"flex-start",justifyContent:"center",height:40,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10},webViewStyle:{width:300,height:300,borderRadius:10}});function wt(){return b.a.createElement(i.View,{style:{padding:10}},b.a.createElement(i.View,{style:vt.itemTitle},b.a.createElement(i.Text,null,"WebView 示例")),b.a.createElement(i.WebView,{source:{uri:"https://www.qq.com"},method:"get",userAgent:"Mozilla/5.0 (Linux; U; Android 5.1.1; zh-cn; vivo X7 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/8.2 Mobile Safari/537.36",style:vt.webViewStyle,onLoad:function(e){var t=e.url;return console.log("webview onload",t)},onLoadStart:function(e){var t=e.url;return console.log("webview onLoadStart",t)},onLoadEnd:function(e){var t=e.url;return console.log("webview onLoadEnd",t)}}))}var xt=i.StyleSheet.create({shadowDemo:{flex:1,overflowY:"scroll"},shadowDemoCubeAndroid:{position:"absolute",left:50,top:50,width:170,height:170,boxShadowOpacity:.6,boxShadowRadius:5,boxShadowColor:"#4c9afa",borderRadius:5},shadowDemoContentAndroid:{position:"absolute",left:5,top:5,width:160,height:160,backgroundColor:"grey",borderRadius:5,display:"flex",justifyContent:"center",alignItems:"center"},shadowDemoCubeIos:{position:"absolute",left:50,top:50,width:160,height:160,boxShadowOpacity:.6,boxShadowRadius:5,boxShadowSpread:1,boxShadowColor:"#4c9afa",borderRadius:5},shadowDemoContentIos:{width:160,height:160,backgroundColor:"grey",borderRadius:5,display:"flex",justifyContent:"center",alignItems:"center"},text:{color:"white"}}),St=i.StyleSheet.create({shadowDemoCubeAndroid:{position:"absolute",left:50,top:300,width:175,height:175,boxShadowOpacity:.6,boxShadowRadius:5,boxShadowOffsetX:15,boxShadowOffsetY:15,boxShadowColor:"#4c9afa"},shadowDemoContentAndroid:{width:160,height:160,backgroundColor:"grey",display:"flex",justifyContent:"center",alignItems:"center"},shadowDemoCubeIos:{position:"absolute",left:50,top:300,width:160,height:160,boxShadowOpacity:.6,boxShadowRadius:5,boxShadowOffsetX:10,boxShadowOffsetY:10,boxShadowSpread:1,boxShadowColor:"#4c9afa"},shadowDemoContentIos:{width:160,height:160,backgroundColor:"grey",display:"flex",justifyContent:"center",alignItems:"center"},text:{color:"white"}});function Tt(){return b.a.createElement(i.View,{style:xt.shadowDemo},"android"===i.Platform.OS?b.a.createElement(i.View,{style:xt.shadowDemoCubeAndroid},b.a.createElement(i.View,{style:xt.shadowDemoContentAndroid},b.a.createElement(i.Text,{style:xt.text},"没有偏移阴影样式"))):b.a.createElement(i.View,{style:xt.shadowDemoCubeIos},b.a.createElement(i.View,{style:xt.shadowDemoContentIos},b.a.createElement(i.Text,{style:xt.text},"没有偏移阴影样式"))),"android"===i.Platform.OS?b.a.createElement(i.View,{style:St.shadowDemoCubeAndroid},b.a.createElement(i.View,{style:St.shadowDemoContentAndroid},b.a.createElement(i.Text,{style:St.text},"偏移阴影样式"))):b.a.createElement(i.View,{style:St.shadowDemoCubeIos},b.a.createElement(i.View,{style:St.shadowDemoContentIos},b.a.createElement(i.Text,{style:St.text},"偏移阴影样式"))))}function Et(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Ct=Ve.filter((function(e){return 2!==e.style})),Rt=i.StyleSheet.create({container:{backgroundColor:"#ffffff"},itemContainer:{padding:12},splitter:{marginLeft:12,marginRight:12,height:.5,backgroundColor:"#e5e5e5"},loading:{fontSize:11,color:"#aaaaaa",alignSelf:"center"},pullContainer:{height:60,backgroundColor:"green"},pullContent:{lineHeight:60,color:"white",height:60,textAlign:"center"},pullFooter:{flex:1,height:40,backgroundColor:"#4c9afa",justifyContent:"center",alignItems:"center"}}),kt=function(e){h()(a,e);var t,n,r,o=Et(a);function a(e){var t;return c()(this,a),(t=o.call(this,e)).state={dataSource:[],pullingText:"继续下拉触发刷新",loadingState:"正在加载..."},t.numberOfColumns=2,t.columnSpacing=6,t.interItemSpacing=6,t.mockFetchData=t.mockFetchData.bind(se()(t)),t.renderItem=t.renderItem.bind(se()(t)),t.getItemType=t.getItemType.bind(se()(t)),t.getItemKey=t.getItemKey.bind(se()(t)),t.onEndReached=t.onEndReached.bind(se()(t)),t.onRefresh=t.onRefresh.bind(se()(t)),t.getRefresh=t.getRefresh.bind(se()(t)),t.renderPullFooter=t.renderPullFooter.bind(se()(t)),t.renderBanner=t.renderBanner.bind(se()(t)),t}return u()(a,[{key:"componentDidMount",value:(r=le()(fe.a.mark((function e(){var t;return fe.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.mockFetchData();case 2:t=e.sent,this.setState({dataSource:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"onEndReached",value:(n=le()(fe.a.mark((function e(){var t,n,r;return fe.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.state.dataSource,!this.loadMoreDataFlag){e.next=3;break}return e.abrupt("return");case 3:return this.loadMoreDataFlag=!0,this.setState({loadingState:"加载更多..."}),n=[],e.prev=6,e.next=9,this.mockFetchData();case 9:n=e.sent,e.next=14;break;case 12:e.prev=12,e.t0=e.catch(6);case 14:0===n.length&&this.setState({loadingState:"没有更多数据"}),r=[].concat(w()(t),w()(n)),this.setState({dataSource:r}),this.loadMoreDataFlag=!1;case 18:case"end":return e.stop()}}),e,this,[[6,12]])}))),function(){return n.apply(this,arguments)})},{key:"renderPullFooter",value:function(){return 0===this.state.dataSource.length?null:b.a.createElement(i.View,{style:Rt.pullFooter},b.a.createElement(i.Text,{style:{color:"white"}},this.state.loadingState))}},{key:"onRefresh",value:(t=le()(fe.a.mark((function e(){var t=this;return fe.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:setTimeout(le()(fe.a.mark((function e(){var n;return fe.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.mockFetchData();case 2:n=e.sent,t.setState({dataSource:n}),t.refresh.refreshComplected();case 5:case"end":return e.stop()}}),e)}))),1e3);case 1:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"getRefresh",value:function(){return b.a.createElement(i.View,{style:{flex:1,height:40,justifyContent:"center",alignItems:"center",backgroundColor:"#4c9afa"}},b.a.createElement(i.Text,{style:{height:40,lineHeight:40,textAlign:"center",color:"white"}},"下拉刷新中..."))}},{key:"onClickItem",value:function(e){console.log("item: ".concat(e," is clicked.."))}},{key:"getItemType",value:function(e){return this.state.dataSource[e].style}},{key:"getItemKey",value:function(e){return"row-".concat(e)}},{key:"onItemClick",value:function(e){console.log("onItemClick",e),this.listView.scrollToIndex({index:e,animation:!0})}},{key:"renderBanner",value:function(){return"android"===i.Platform.OS||0===this.state.dataSource.length?null:b.a.createElement(i.View,{style:{backgroundColor:"grey",height:100,justifyContent:"center",alignItems:"center"}},b.a.createElement(i.Text,{style:{fontSize:20,color:"white",lineHeight:100,height:100}},"Banner View"))}},{key:"renderItem",value:function(e){var t=this,n=null,r=this.state.dataSource[e];switch(r.style){case 1:n=b.a.createElement(De,{itemBean:r.itemBean});break;case 2:n=b.a.createElement(ze,{itemBean:r.itemBean});break;case 5:n=b.a.createElement(Ne,{itemBean:r.itemBean})}return b.a.createElement(i.View,{onClick:function(){return t.onItemClick(e)},style:Rt.container},b.a.createElement(i.View,{style:Rt.itemContainer},n),b.a.createElement(i.View,{style:Rt.splitter}))}},{key:"mockFetchData",value:function(){return new Promise((function(e){setTimeout((function(){var t=[].concat(w()(Ct),w()(Ct));return e(t)}),600)}))}},{key:"getWaterfallContentInset",value:function(){return{top:0,left:5,bottom:0,right:5}}},{key:"getItemStyle",value:function(){var e=this.numberOfColumns,t=this.columnSpacing,n=i.Dimensions.get("screen").width,r=this.getWaterfallContentInset();return{width:(n-r.left-r.right-(e-1)*t)/e}}},{key:"render",value:function(){var e=this,t=this.state.dataSource,n=this.numberOfColumns,r=this.columnSpacing,o=this.interItemSpacing,a=this.getWaterfallContentInset();return b.a.createElement(i.RefreshWrapper,{ref:function(t){e.refresh=t},style:{flex:1},onRefresh:this.onRefresh,bounceTime:100,getRefresh:this.getRefresh},b.a.createElement(i.WaterfallView,{ref:function(t){e.listView=t},renderBanner:this.renderBanner,numberOfColumns:n,columnSpacing:r,interItemSpacing:o,numberOfItems:t.length,style:{flex:1},renderItem:this.renderItem,onEndReached:this.onEndReached,getItemType:this.getItemType,getItemKey:this.getItemKey,contentInset:a,getItemStyle:function(){return e.getItemStyle()},containPullFooter:!0,renderPullFooter:this.renderPullFooter}))}}]),a}(b.a.Component);function At(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Vt="#4c9afa",jt="#f44837",It=i.StyleSheet.create({container:{paddingHorizontal:10},square:{width:80,height:80,backgroundColor:jt},showArea:{height:150,marginVertical:10},button:{borderColor:Vt,borderWidth:2,justifyContent:"center",alignItems:"center",width:70,borderRadius:8,height:50,marginTop:20,marginRight:8},buttonText:{fontSize:20,color:Vt,textAlign:"center",textAlignVertical:"center"},colorText:{fontSize:14,color:"white",textAlign:"center",textAlignVertical:"center"},buttonContainer:{flexDirection:"row",alignItems:"center"},title:{fontSize:24,marginTop:8}}),Ot=function(e){h()(n,e);var t=At(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={},r}return u()(n,[{key:"componentWillMount",value:function(){this.horizonAnimation=new i.Animation({startValue:150,toValue:20,duration:1e3,delay:500,mode:"timing",timingFunction:"linear",repeatCount:"loop"}),this.verticalAnimation=new i.Animation({startValue:80,toValue:40,duration:1e3,delay:0,mode:"timing",timingFunction:"linear",repeatCount:"loop"}),this.scaleAnimationSet=new i.AnimationSet({children:[{animation:new i.Animation({startValue:1,toValue:1.2,duration:1e3,delay:0,mode:"timing",timingFunction:"linear"}),follow:!1},{animation:new i.Animation({startValue:1.2,toValue:.2,duration:1e3,delay:0,mode:"timing",timingFunction:"linear"}),follow:!0}],repeatCount:"loop"}),this.bgColorAnimationSet=new i.AnimationSet({children:[{animation:new i.Animation({startValue:"red",toValue:"yellow",valueType:"color",duration:1e3,delay:0,mode:"timing",timingFunction:"linear"}),follow:!1},{animation:new i.Animation({startValue:"yellow",toValue:"blue",duration:1e3,valueType:"color",delay:0,mode:"timing",timingFunction:"linear"}),follow:!0}],repeatCount:"loop"}),this.txtColorAnimationSet=new i.AnimationSet({children:[{animation:new i.Animation({startValue:"white",toValue:"yellow",valueType:"color",duration:1e3,delay:0,mode:"timing",timingFunction:"linear"}),follow:!1},{animation:new i.Animation({startValue:"yellow",toValue:"white",duration:1e3,valueType:"color",delay:0,mode:"timing",timingFunction:"linear"}),follow:!0}],repeatCount:"loop"}),this.cubicBezierScaleAnimationSet=new i.AnimationSet({children:[{animation:new i.Animation({startValue:0,toValue:1,duration:1e3,delay:0,mode:"timing",timingFunction:"cubic-bezier(.45,2.84,.38,.5)"}),follow:!1},{animation:new i.Animation({startValue:1,toValue:0,duration:1e3,mode:"timing",timingFunction:"cubic-bezier(.17,1.45,.78,.14)"}),follow:!0}],repeatCount:"loop"})}},{key:"componentDidMount",value:function(){"web"===i.Platform.OS&&(this.verticalAnimation.setRef(this.verticalRef),this.horizonAnimation.setRef(this.horizonRef),this.scaleAnimationSet.setRef(this.scaleRef),this.bgColorAnimationSet.setRef(this.bgColorRef),this.txtColorAnimationSet.setRef(this.textColorRef),this.cubicBezierScaleAnimationSet.setRef(this.cubicBezierScaleRef)),this.horizonAnimation.onHippyAnimationStart((function(){console.log("on animation start!!!")})),this.horizonAnimation.onHippyAnimationEnd((function(){console.log("on animation end!!!")})),this.horizonAnimation.onHippyAnimationCancel((function(){console.log("on animation cancel!!!")})),this.horizonAnimation.onHippyAnimationRepeat((function(){console.log("on animation end!!!")}))}},{key:"componentWillUnmount",value:function(){this.scaleAnimationSet&&this.scaleAnimationSet.destroy(),this.horizonAnimation&&this.horizonAnimation.destroy(),this.verticalAnimation&&this.verticalAnimation.destroy(),this.cubicBezierScaleAnimationSet&&this.cubicBezierScaleAnimationSet.destroy()}},{key:"render",value:function(){var e=this;return b.a.createElement(i.ScrollView,{style:It.container},b.a.createElement(i.Text,{style:It.title},"水平位移动画"),b.a.createElement(i.View,{style:It.buttonContainer},b.a.createElement(i.View,{style:It.button,onClick:function(){e.horizonAnimation.start()}},b.a.createElement(i.Text,{style:It.buttonText},"开始")),b.a.createElement(i.View,{style:[It.button],onClick:function(){e.horizonAnimation.pause()}},b.a.createElement(i.Text,{style:It.buttonText},"暂停")),b.a.createElement(i.View,{style:It.button,onClick:function(){e.horizonAnimation.resume()}},b.a.createElement(i.Text,{style:It.buttonText},"继续")),b.a.createElement(i.View,{style:It.button,onClick:function(){e.horizonAnimation.updateAnimation({startValue:50,toValue:100})}},b.a.createElement(i.Text,{style:It.buttonText},"更新"))),b.a.createElement(i.View,{style:It.showArea},b.a.createElement(i.View,{ref:function(t){e.horizonRef=t},style:[It.square,{transform:[{translateX:this.horizonAnimation}]}]})),b.a.createElement(i.Text,{style:It.title},"高度形变动画"),b.a.createElement(i.View,{style:It.buttonContainer},b.a.createElement(i.View,{style:It.button,onClick:function(){e.verticalAnimation.start()}},b.a.createElement(i.Text,{style:It.buttonText},"开始")),b.a.createElement(i.View,{style:[It.button],onClick:function(){e.verticalAnimation.pause()}},b.a.createElement(i.Text,{style:It.buttonText},"暂停")),b.a.createElement(i.View,{style:It.button,onClick:function(){e.verticalAnimation.resume()}},b.a.createElement(i.Text,{style:It.buttonText},"继续"))),b.a.createElement(i.View,{style:It.showArea},b.a.createElement(i.View,{ref:function(t){e.verticalRef=t},style:[It.square,{height:this.verticalAnimation}]})),b.a.createElement(i.Text,{style:It.title},"组合形变动画"),b.a.createElement(i.View,{style:It.buttonContainer},b.a.createElement(i.View,{style:It.button,onClick:function(){e.scaleAnimationSet.start()}},b.a.createElement(i.Text,{style:It.buttonText},"开始")),b.a.createElement(i.View,{style:[It.button],onClick:function(){e.scaleAnimationSet.pause()}},b.a.createElement(i.Text,{style:It.buttonText},"暂停")),b.a.createElement(i.View,{style:It.button,onClick:function(){e.scaleAnimationSet.resume()}},b.a.createElement(i.Text,{style:It.buttonText},"继续"))),b.a.createElement(i.View,{style:[It.showArea,{marginVertical:20}]},b.a.createElement(i.View,{ref:function(t){e.scaleRef=t},style:[It.square,{transform:[{scale:this.scaleAnimationSet}]}]})),b.a.createElement(i.Text,{style:It.title},"颜色渐变动画(文字渐变仅Android支持)"),b.a.createElement(i.View,{style:It.buttonContainer},b.a.createElement(i.View,{style:It.button,onClick:function(){e.bgColorAnimationSet.start(),e.txtColorAnimationSet.start()}},b.a.createElement(i.Text,{style:It.buttonText},"开始")),b.a.createElement(i.View,{style:[It.button],onClick:function(){e.bgColorAnimationSet.pause(),e.txtColorAnimationSet.pause()}},b.a.createElement(i.Text,{style:It.buttonText},"暂停")),b.a.createElement(i.View,{style:It.button,onClick:function(){e.bgColorAnimationSet.resume(),e.txtColorAnimationSet.resume()}},b.a.createElement(i.Text,{style:It.buttonText},"继续"))),b.a.createElement(i.View,{style:[It.showArea,{marginVertical:20}]},b.a.createElement(i.View,{ref:function(t){e.bgColorRef=t},style:[It.square,{justifyContent:"center",alignItems:"center"},{backgroundColor:this.bgColorAnimationSet}]},b.a.createElement(i.Text,{ref:function(t){e.textColorRef=t},style:[It.colorText,{color:"android"===i.Platform.OS?this.txtColorAnimationSet:"white"}]},"颜色渐变背景和文字"))),b.a.createElement(i.Text,{style:It.title},"贝塞尔曲线动画"),b.a.createElement(i.View,{style:It.buttonContainer},b.a.createElement(i.View,{style:It.button,onClick:function(){e.cubicBezierScaleAnimationSet.start()}},b.a.createElement(i.Text,{style:It.buttonText},"开始")),b.a.createElement(i.View,{style:[It.button],onClick:function(){e.cubicBezierScaleAnimationSet.pause()}},b.a.createElement(i.Text,{style:It.buttonText},"暂停")),b.a.createElement(i.View,{style:It.button,onClick:function(){e.cubicBezierScaleAnimationSet.resume()}},b.a.createElement(i.Text,{style:It.buttonText},"继续"))),b.a.createElement(i.View,{style:[It.showArea,{marginVertical:20}]},b.a.createElement(i.View,{ref:function(t){e.cubicBezierScaleRef=t},style:[It.square,{transform:[{scale:this.cubicBezierScaleAnimationSet}]}]})))}}]),n}(b.a.Component);function Pt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Dt=i.StyleSheet.create({containerStyle:{margin:20,alignItems:"center",flexDirection:"column"},itemGroupStyle:{flexDirection:"row",marginTop:10,borderColor:"#4c9afa",borderWidth:1,width:100,height:40,justifyContent:"center",alignItems:"center"},viewGroupStyle:{flexDirection:"row",marginTop:10},infoStyle:{width:60,height:40,fontSize:16,color:"#4c9afa",textAlign:"center"},inputStyle:{width:200,height:40,placeholderTextColor:"#aaaaaa",underlineColorAndroid:"#4c9afa",fontSize:16,color:"#242424",textAlign:"left"},buttonStyle:{textAlign:"center",fontSize:16,color:"#4c9afa",backgroundColor:"#4c9afa11",marginLeft:10,marginRight:10}}),_t=function(e){h()(n,e);var t=Pt(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={result:""},r.onTextChangeKey=r.onTextChangeKey.bind(se()(r)),r.onTextChangeValue=r.onTextChangeValue.bind(se()(r)),r.onClickSet=r.onClickSet.bind(se()(r)),r.onTextChangeKey=r.onTextChangeKey.bind(se()(r)),r.onClickGet=r.onClickGet.bind(se()(r)),r}return u()(n,[{key:"onClickSet",value:function(){var e=this.state,t=e.key,n=e.value;t&&i.AsyncStorage.setItem(t,n)}},{key:"onClickGet",value:function(){var e=this,t=this.state.key;t&&i.AsyncStorage.getItem(t).then((function(t){e.setState({result:t})}))}},{key:"onTextChangeKey",value:function(e){this.setState({key:e})}},{key:"onTextChangeValue",value:function(e){this.setState({value:e})}},{key:"render",value:function(){var e=this.state.result;return b.a.createElement(i.ScrollView,{style:Dt.containerStyle},b.a.createElement(i.View,{style:Dt.viewGroupStyle},b.a.createElement(i.Text,{style:Dt.infoStyle},"Key:"),b.a.createElement(i.TextInput,{style:Dt.inputStyle,onChangeText:this.onTextChangeKey})),b.a.createElement(i.View,{style:Dt.viewGroupStyle},b.a.createElement(i.Text,{style:Dt.infoStyle},"Value:"),b.a.createElement(i.TextInput,{style:Dt.inputStyle,onChangeText:this.onTextChangeValue})),b.a.createElement(i.View,{style:Dt.itemGroupStyle,onClick:this.onClickSet},b.a.createElement(i.Text,{style:Dt.buttonStyle},"Set")),b.a.createElement(i.View,{style:[Dt.viewGroupStyle,{marginTop:60}]},b.a.createElement(i.Text,{style:Dt.infoStyle},"Key:"),b.a.createElement(i.TextInput,{style:Dt.inputStyle,onChangeText:this.onTextChangeKey})),b.a.createElement(i.View,{style:[Dt.viewGroupStyle,{display:"none"}]},b.a.createElement(i.Text,{style:Dt.infoStyle},"Value:"),b.a.createElement(i.Text,{style:[Dt.infoStyle,{width:200}]},e)),b.a.createElement(i.View,{style:Dt.itemGroupStyle,onClick:this.onClickGet},b.a.createElement(i.Text,{style:Dt.buttonStyle},"Get")))}}]),n}(b.a.Component);function Lt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Bt=i.StyleSheet.create({itemTitle:{alignItems:"flex-start",justifyContent:"center",height:40,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10},defaultText:{marginVertical:4,fontSize:18,lineHeight:24,color:"#242424"},copiedText:{color:"#aaa"},button:{backgroundColor:"#4c9afa",borderRadius:4,height:30,marginVertical:4,paddingHorizontal:6,alignItems:"center",justifyContent:"center"},buttonText:{fontSize:16,color:"white"}}),Mt=function(e){h()(n,e);var t=Lt(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={hasCopied:!1,text:"Winter is coming",clipboardText:"快点上面的按钮啊魂淡"},r}return u()(n,[{key:"render",value:function(){var e=this,t=function(e){return b.a.createElement(i.View,{style:Bt.itemTitle},b.a.createElement(i.Text,null,e))},n=this.state,r=n.hasCopied,o=n.text,a=n.clipboardText,l=r?" (已复制) ":"";return b.a.createElement(i.ScrollView,{style:{padding:10}},t("文本复制到剪贴板"),b.a.createElement(i.Text,{style:Bt.defaultText},o),b.a.createElement(i.View,{style:Bt.button,onClick:function(){i.Clipboard.setString(o),e.setState({hasCopied:!0})}},b.a.createElement(i.Text,{style:Bt.buttonText},"点击复制以上文案".concat(l))),t("获取剪贴板内容"),b.a.createElement(i.View,{style:Bt.button,onClick:le()(fe.a.mark((function t(){var n;return fe.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.Clipboard.getString();case 3:n=t.sent,e.setState({clipboardText:n}),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),console.error(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})))},b.a.createElement(i.Text,{style:Bt.buttonText},"点击获取剪贴板内容")),b.a.createElement(i.Text,{style:[Bt.defaultText,Bt.copiedText]},a))}}]),n}(b.a.Component);function zt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Ft=i.StyleSheet.create({text:{fontSize:14,color:"#242424",alignSelf:"center"},container:{flex:1},itemTitle:{alignItems:"flex-start",justifyContent:"center",height:80,borderWidth:1,borderColor:"#e0e0e0",borderRadius:2,backgroundColor:"#fafafa",padding:10,marginTop:10},itemContent:{alignItems:"flex-start",justifyContent:"center",height:100,borderBottomWidth:1,borderLeftWidth:1,borderRightWidth:1,borderRadius:2,borderColor:"#e0e0e0",backgroundColor:"#ffffff",padding:10},normalText:{fontSize:14,lineHeight:18,color:"black"}}),Wt=function(e){h()(n,e);var t=zt(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={infoText:"",infoText2:""},r}return u()(n,[{key:"render",value:function(){var e=this,t=this.state,n=t.infoText,r=t.infoText2;return b.a.createElement(i.ScrollView,{style:Ft.container},b.a.createElement(i.View,{style:Ft.itemTitle,onPress:function(){var t=new i.HippyEventEmitter;e.call=t.addListener("NORMAL_EVENT",(function(t){e.setState({infoText:JSON.stringify(t)})})),Object(i.callNative)("MyEvent","btnClicked")}},b.a.createElement(i.Text,null,"客户端向前端单向通信"),b.a.createElement(i.Text,null,"点此终端会发送NORMAL_EVENT事件"),b.a.createElement(i.Text,null,"事件接收结果:".concat(n))),b.a.createElement(i.View,{style:Ft.itemTitle,onPress:function(){var t=new i.HippyEventEmitter;e.call=t.addListener("COUNT_DOWN",(function(t){e.setState({infoText2:JSON.stringify(t)})})),Object(i.callNative)("MyEvent","addListener","COUNT_DOWN")}},b.a.createElement(i.Text,null,"客户端向前端单向通信的进阶用法"),b.a.createElement(i.Text,null,"点此终端会发送COUNT_DOWN事件"),b.a.createElement(i.Text,null,"事件接收结果:".concat(r))))}}]),n}(b.a.Component);function Ht(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Nt=i.StyleSheet.create({text:{fontSize:14,color:"#242424",alignSelf:"center"},container:{flex:1,justifyContent:"center"}}),Kt=function(e){h()(r,e);var t,n=Ht(r);function r(e){var t;return c()(this,r),(t=n.call(this,e)).state={infoText:"正在获取.."},t.listener=null,t}return u()(r,[{key:"componentWillMount",value:(t=le()(fe.a.mark((function e(){var t,n;return fe.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this,e.next=3,i.NetInfo.fetch();case 3:n=e.sent,this.setState({infoText:n}),this.listener=i.NetInfo.addEventListener("change",(function(e){t.setState({infoText:"收到通知: ".concat(e.network_info)})}));case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"componentDidMount",value:function(){var e=this;this.listener&&i.NetInfo.removeEventListener("change",this.listener),fetch("https://m.baidu.com",{headers:{Refer:"https://now.qq.com",Cookie:["harry=guo5","xxx=5"]}}).then((function(t){return console.log("成功",t),e.setState({infoText:"成功: ".concat(t.body)}),t})).catch((function(t){e.setState({infoText:"收到错误: ".concat(t)}),console.error("收到错误:",t)})),i.NetworkModule.setCookie("http://3gxx.qq.com","name=harryguo;gender=male"),i.NetworkModule.getCookies("http://3gxx.qq.com").then((function(e){console.log("cookie: ".concat(e))}))}},{key:"render",value:function(){var e=this.state.infoText;return b.a.createElement(i.ScrollView,{style:Nt.container},b.a.createElement(i.Text,{style:Nt.text},e))}}]),r}(b.a.Component),Ut={log:function(e){Object(i.callNative)("TestModule","log",e)},helloNative:function(e){Object(i.callNative)("TestModule","helloNative",e)},helloNativeWithPromise:function(e){return Object(i.callNativeWithPromise)("TestModule","helloNativeWithPromise",e)}};function qt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var Gt,Qt=function(e){h()(n,e);var t=qt(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).state={hello:"TestModule log"},r}return u()(n,[{key:"componentDidMount",value:function(){var e=this;Ut.log("hello i am from js"),Ut.helloNative({hello:"i am form js"}),Ut.helloNativeWithPromise({hello:"i am form js"}).then((function(t){e.setState({hello:JSON.stringify(t)})}))}},{key:"render",value:function(){var e=this.state.hello;return b.a.createElement(i.Text,{style:{color:"red"}},e)}}]),n}(b.a.Component),Yt=n("./node_modules/@babel/runtime/helpers/slicedToArray.js"),Jt=n.n(Yt),Xt=i.StyleSheet.create({fullScreen:{flex:1},row:{flexDirection:"row"},title:{color:"#ccc"},button:{height:56,backgroundColor:"#4c9afa",borderColor:"#5dabfb",borderStyle:"solid",borderWidth:1,paddingHorizontal:20,fontSize:16,textAlign:"center",lineHeight:56,color:"#fff",margin:10},input:{color:"black",flex:1,height:36,lineHeight:36,fontSize:14,borderBottomColor:"#4c9afa",borderBottomStyle:"solid",borderBottomWidth:1,padding:0},output:{color:"black"}}),Zt="wss://echo.websocket.org",$t="Rock it with Hippy WebSocket";var en=function(){var e=Object(g.useRef)(null),t=Object(g.useRef)(null),n=Object(g.useState)([]),r=Jt()(n,2),o=r[0],a=r[1],l=function(e){a((function(t){return[e].concat(w()(t))}))};return b.a.createElement(i.View,{style:Xt.fullScreen},b.a.createElement(i.View,null,b.a.createElement(i.Text,{style:Xt.title},"Url:"),b.a.createElement(i.TextInput,{ref:e,value:Zt,style:Xt.input}),b.a.createElement(i.View,{style:Xt.row},b.a.createElement(i.Text,{onClick:function(){e.current.getValue().then((function(e){Gt&&1===Gt.readyState&&Gt.close(),(Gt=new WebSocket(e)).onopen=function(){return l("[Opened] ".concat(Gt.url))},Gt.onclose=function(){return l("[Closed] ".concat(Gt.url))},Gt.onerror=function(e){return l("[Error] ".concat(e.reason))},Gt.onmessage=function(e){return l("[Received] ".concat(e.data))}}))},style:Xt.button},"Connect"),b.a.createElement(i.Text,{onClick:function(){return Gt.close()},style:Xt.button},"Disconnect"))),b.a.createElement(i.View,null,b.a.createElement(i.Text,{style:Xt.title},"Message:"),b.a.createElement(i.TextInput,{ref:t,value:$t,style:Xt.input}),b.a.createElement(i.Text,{onClick:function(){return t.current.getValue().then((function(e){l("[Sent] ".concat(e)),Gt.send(e)}))},style:Xt.button},"Send")),b.a.createElement(i.View,null,b.a.createElement(i.Text,{style:Xt.title},"Log:"),b.a.createElement(i.ScrollView,{style:Xt.fullScreen},o.map((function(e,t){return b.a.createElement(i.Text,{key:t,style:Xt.output},e)})))))};function tn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function nn(e){for(var t=1;t=o||(this.indicator.update(r),this.currentIndex=r)}}},{key:"onScrollBeginDrag",value:function(){this.touchStartOffset=this.scrollOffset,this.doClearTimer()}},{key:"onScrollEndDrag",value:function(){this.doCreateTimer()}},{key:"onLayout",value:function(e){this.width=e.layout.width}},{key:"doSwitchPage",value:function(e){this.scrollview.scrollTo(this.imgWidth*e,0,!0)}},{key:"doCreateTimer",value:function(){var e=this;this.doClearTimer(),this.duration<=0||(this.interval=setInterval((function(){e.doSwitchPage((e.currentIndex+1)%e.itemCount)}),this.duration))}},{key:"doClearTimer",value:function(){this.interval&&clearInterval(this.interval),this.interval=null}},{key:"render",value:function(){for(var e=this,t=this.props.images,n=[],r=0;rr-a?60*r-o:60*n-60*a+30,this.navScrollView.scrollTo({x:e,y:0,animated:!0})}}},{key:"pressNavItem",value:function(e){this.setState({curIndex:e}),this.viewPager&&this.viewPager.setPage(e)}},{key:"renderNav",value:function(){var e=this,t=this.state,n=t.navList,r=t.curIndex;return b.a.createElement(i.View,{style:xn.container},b.a.createElement(i.ScrollView,{style:xn.scroll,horizontal:!0,showsHorizontalScrollIndicator:!1,ref:function(t){e.navScrollView=t}},n.map((function(t,n){return b.a.createElement(i.View,{style:xn.navItem,key:"nav_".concat(t),activeOpacity:.5,onClick:function(){return e.pressNavItem(n)}},b.a.createElement(i.Text,{style:[xn.navItemText,r===n?xn.navItemTextBlue:xn.navItemTextNormal],numberOfLines:1},t))}))))}},{key:"render",value:function(){var e=this,t=this.state.navList;return b.a.createElement(i.View,{style:{flex:1,backgroundColor:"#ffffff"}},this.renderNav(),b.a.createElement(i.ViewPager,{ref:function(t){e.viewPager=t},style:{flex:1},initialPage:0,onPageSelected:function(t){return e.onViewPagerChange(t.position)}},t.map((function(e,t){return n.getPage(e,t)}))))}}],[{key:"getPage",value:function(e,t){switch(t%3){case 0:return dt(e);case 1:return pt(e);case 2:return mt(e);default:return null}}}]),n}(b.a.Component);function Tn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var En=i.Dimensions.get("window").width,Cn=i.StyleSheet.create({setNativePropsDemo:{display:"flex",alignItems:"center",position:"relative"},nativeDemo1Drag:{height:80,width:En,backgroundColor:"#4c9afa",position:"relative",marginTop:10},nativeDemo1Point:{height:80,width:80,color:"#ff0000",backgroundColor:"#ff0000",position:"absolute",left:0},nativeDemo2Drag:{height:80,width:En,backgroundColor:"#4c9afa",position:"relative",marginTop:10},nativeDemo2Point:{height:80,width:80,color:"#ff0000",backgroundColor:"#ff0000",position:"absolute",left:0},splitter:{marginTop:50}}),Rn=function(e){h()(n,e);var t=Tn(n);function n(e){var r;return c()(this,n),(r=t.call(this,e)).demon1Point=b.a.createRef(),r.demo1PointDom=null,r.state={demo2Left:0},r.isDemon1Layouted=!1,r.idDemon2Layouted=!1,r}return u()(n,[{key:"componentDidMount",value:function(){}},{key:"onDemon1Layout",value:function(){this.isDemon1Layouted||(this.isDemon1Layouted=!0,this.demo1PointDom=i.UIManagerModule.getElementFromFiberRef(this.demon1Point.current))}},{key:"onTouchDown1",value:function(e){var t=e.page_x,n=t-40;console.log("touchdown x",t,n,En),this.demo1PointDom&&this.demo1PointDom.setNativeProps({style:{left:n}})}},{key:"onTouchMove1",value:function(e){var t=e.page_x,n=t-40;console.log("touchmove x",t,n,En),this.demo1PointDom&&this.demo1PointDom.setNativeProps({style:{left:n}})}},{key:"onTouchDown2",value:function(e){var t=e.page_x,n=t-40;console.log("touchdown x",t,n,En),this.setState({demo2Left:n})}},{key:"onTouchMove2",value:function(e){var t=e.page_x,n=t-40;console.log("touchmove x",t,n,En),this.setState({demo2Left:n})}},{key:"render",value:function(){var e=this,t=this.state.demo2Left;return b.a.createElement(i.View,{style:Cn.setNativePropsDemo},b.a.createElement(i.Text,null,"setNativeProps实现拖动效果"),b.a.createElement(i.View,{style:Cn.nativeDemo1Drag,onTouchDown:function(t){return e.onTouchDown1(t)},onTouchMove:function(t){return e.onTouchMove1(t)}},b.a.createElement(i.View,{onLayout:function(){return e.onDemon1Layout()},style:Cn.nativeDemo1Point,ref:this.demon1Point})),b.a.createElement(i.View,{style:Cn.splitter}),b.a.createElement(i.Text,null,"普通渲染实现拖动效果"),b.a.createElement(i.View,{style:Cn.nativeDemo2Drag,onTouchDown:function(t){return e.onTouchDown2(t)},onTouchMove:function(t){return e.onTouchMove2(t)}},b.a.createElement(i.View,{style:[Cn.nativeDemo2Point,{left:t}]})))}}]),n}(b.a.Component);function kn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var An=i.StyleSheet.create({dynamicImportDemo:{marginTop:20,display:"flex",flex:1,alignItems:"center",position:"relative",flexDirection:"column"}}),Vn=function(e){h()(r,e);var t=kn(r);function r(e){var n;return c()(this,r),(n=t.call(this,e)).state={AsyncComponentFromLocal:null,AsyncComponentFromHttp:null},n.onAsyncComponentLoad=n.onAsyncComponentLoad.bind(se()(n)),n}return u()(r,[{key:"onAsyncComponentLoad",value:function(){var e=this;console.log("load async component"),n.e(1).then(n.bind(null,"./src/externals/DyanmicImport/AsyncComponentLocal.jsx")).then((function(t){e.setState({AsyncComponentFromLocal:t.default||t})})).catch((function(e){return console.error("import async local component error",e)})),n.e(0).then(n.bind(null,"./src/externals/DyanmicImport/AsyncComponentHttp.jsx")).then((function(t){e.setState({AsyncComponentFromHttp:t.default||t})})).catch((function(e){return console.error("import async remote component error",e)}))}},{key:"render",value:function(){var e=this.state,t=e.AsyncComponentFromLocal,n=e.AsyncComponentFromHttp;return b.a.createElement(i.View,{style:An.dynamicImportDemo},b.a.createElement(i.View,{style:{width:130,height:40,textAlign:"center",backgroundColor:"#4c9afa",borderRadius:5},onTouchDown:this.onAsyncComponentLoad},b.a.createElement(i.Text,{style:{height:40,lineHeight:40,textAlign:"center"}},"点我异步加载")),b.a.createElement(i.View,{style:{marginTop:20}},t?b.a.createElement(t,null):null,n?b.a.createElement(n,null):null))}}]),r}(b.a.Component);function jn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var In=i.StyleSheet.create({LocalizationDemo:{marginTop:20,display:"flex",flex:1,alignItems:"center",position:"relative",flexDirection:"column"}}),On=function(e){h()(n,e);var t=jn(n);function n(){return c()(this,n),t.apply(this,arguments)}return u()(n,[{key:"render",value:function(){var e=i.Platform.Localization||{},t=e.country,n=e.language,r=e.direction;return b.a.createElement(i.View,{style:In.LocalizationDemo},b.a.createElement(i.View,{style:{height:40,textAlign:"center",backgroundColor:"#4c9afa",borderRadius:5},onTouchDown:this.onAsyncComponentLoad},b.a.createElement(i.Text,{style:{color:"white",marginHorizontal:30,height:40,lineHeight:40,textAlign:"center"}},"国际化相关信息:国家 ".concat(t," | 语言 ").concat(n," | 方向 ").concat(1===r?"RTL":"LTR"))))}}]),n}(b.a.Component),Pn=function(){var e=le()(fe.a.mark((function e(t){return fe.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",turboPromise(getTurboModule("demoTurbo").nativeWithPromise)(t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function Dn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var _n=i.StyleSheet.create({container:{flex:1},cellContentView:{flexDirection:"row",justifyContent:"space-between",backgroundColor:"#ccc",marginBottom:1},funcInfo:{justifyContent:"center",paddingLeft:15,paddingRight:15},actionButton:{backgroundColor:"#4c9afa",color:"#fff",height:44,lineHeight:44,textAlign:"center",width:80,borderRadius:6},resultView:{backgroundColor:"darkseagreen",minHeight:150,padding:15}}),Ln=function(e){h()(r,e);var t,n=Dn(r);function r(e){var t;return c()(this,r),(t=n.call(this,e)).state={config:null,result:"",funList:["getString","getNum","getBoolean","getMap","getObject","getArray","nativeWithPromise","getTurboConfig","printTurboConfig","getInfo","setInfo"]},t.onTurboFunc=t.onTurboFunc.bind(se()(t)),t.getRenderRow=t.getRenderRow.bind(se()(t)),t.getRowKey=t.getRowKey.bind(se()(t)),t}return u()(r,[{key:"onTurboFunc",value:(t=le()(fe.a.mark((function e(t){var n;return fe.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("nativeWithPromise"!==t){e.next=6;break}return e.next=3,Pn("aaa");case 3:n=e.sent,e.next=7;break;case 6:"getTurboConfig"===t?(this.config=getTurboModule("demoTurbo").getTurboConfig(),n="获取到config对象"):"printTurboConfig"===t?(r=this.config,n=getTurboModule("demoTurbo").printTurboConfig(r)):"getInfo"===t?n=this.config.getInfo():"setInfo"===t?(this.config.setInfo("Hello World"),n="设置config信息成功"):n={getString:function(){return e="123",getTurboModule("demoTurbo").getString(e);var e},getNum:function(){return e=1024,getTurboModule("demoTurbo").getNum(e);var e},getBoolean:function(){return e=!0,getTurboModule("demoTurbo").getBoolean(e);var e},getMap:function(){return e=new Map([["a","1"],["b",2]]),getTurboModule("demoTurbo").getMap(e);var e},getObject:function(){return e={c:"3",d:"4"},getTurboModule("demoTurbo").getObject(e);var e},getArray:function(){return e=["a","b","c"],getTurboModule("demoTurbo").getArray(e);var e}}[t]();case 7:this.setState({result:n});case 8:case"end":return e.stop()}var r}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"renderResultView",value:function(){return b.a.createElement(i.View,{style:_n.resultView},b.a.createElement(i.Text,{style:{backgroundColor:"darkseagreen"}},"".concat(this.state.result)))}},{key:"getRenderRow",value:function(e){var t=this,n=this.state.funList;return b.a.createElement(i.View,{style:_n.cellContentView},b.a.createElement(i.View,{style:_n.funcInfo},b.a.createElement(i.Text,{numberofLines:0},"函数名:",n[e])),b.a.createElement(i.Text,{style:_n.actionButton,onClick:function(){return t.onTurboFunc(n[e])}},"执行"))}},{key:"getRowKey",value:function(e){return this.state.funList[e]}},{key:"render",value:function(){var e=this.state.funList;return b.a.createElement(i.View,{style:_n.container},this.renderResultView(),b.a.createElement(i.ListView,{numberOfRows:e.length,renderRow:this.getRenderRow,getRowKey:this.getRowKey,style:{flex:1}}))}}]),r}(b.a.Component);function Bn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Mn(e){for(var t=1;t Develop 菜单进行调试(需要在预置 -> 高级里打开开发者菜单)"),e.push("注意:每次插拔 USB 线后都需要通过 npm run hippy:debug 重启调试服务"));return b.a.createElement(i.ScrollView,{style:Zn.container},e.map((function(e,t){return b.a.createElement(i.Text,{style:Zn.stepText,key:"steps-".concat(t)},e)})),b.a.createElement(i.View,{style:Zn.buttonContainer},b.a.createElement(i.View,{style:Zn.button,onClick:this.clickToDebug},b.a.createElement(i.Text,{style:Zn.buttonText,numberOfLines:1},"点击调试"))))}}]),n}(g.Component);function er(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y()(e);if(t){var o=y()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}var tr=i.StyleSheet.create({container:{flex:1}}),nr=function(e){h()(n,e);var t=er(n);function n(e){var r;c()(this,n),r=t.call(this,e);var o=i.Dimensions.get("window").width,a=i.Dimensions.get("window").height;return r.state={isVertical:o& items = children; for (size_t i = 0; i < items.size(); i++) { MTTNodeRef item = items[i]; - item->convertLayoutResult(absLeft, absTop); + item->convertLayoutResult(absLeft, absTop, scaleFactor); } } diff --git a/ios/sdk/layout/MTTNode.h b/ios/sdk/layout/MTTNode.h index 22fe211239c..c8110da0c9c 100755 --- a/ios/sdk/layout/MTTNode.h +++ b/ios/sdk/layout/MTTNode.h @@ -38,6 +38,7 @@ typedef void (*MTTDirtiedFunc)(MTTNodeRef node); class MTTNode { public: MTTNode(); + MTTNode(float sf); virtual ~MTTNode(); void initLayoutResult(); bool reset(); @@ -102,6 +103,12 @@ class MTTNode { void setLayoutDirection(MTTDirection direction); MTTDirection getLayoutDirection(); FlexAlign getNodeAlign(MTTNodeRef item); + void setScaleFactor(float sf) { + scaleFactor = sf; + }; + float getScaleFactor() { + return scaleFactor; + } protected: MTTDirection resolveDirection(MTTDirection parentDirection); @@ -135,7 +142,7 @@ class MTTNode { void layoutFixedItems(MTTSizeMode measureMode, void *layoutContext); void calculateFixedItemPosition(MTTNodeRef item, FlexDirection axis); - void convertLayoutResult(float absLeft, float absTop); + void convertLayoutResult(float absLeft, float absTop, float scaleFactor); public: MTTStyle style; @@ -155,6 +162,7 @@ class MTTNode { MTTLayoutCache layoutCache; // layout result is in initial state or not bool inInitailState; + float scaleFactor; #ifdef LAYOUT_TIME_ANALYZE int fetchCount; #endif diff --git a/ios/sdk/layout/MTTUtil.cpp b/ios/sdk/layout/MTTUtil.cpp index 5b812f15ed6..0d90be0078a 100755 --- a/ios/sdk/layout/MTTUtil.cpp +++ b/ios/sdk/layout/MTTUtil.cpp @@ -91,23 +91,27 @@ bool MTTSizeIsEqualInScale(MTTSize a, MTTSize b, float scale) { FloatIsEqualInScale(a.height, b.height, scale); } -float MTTRoundValueToPixelGrid(float value, bool forceCeil, bool forceFloor) { - float fractial = fmodf(value, 1.0); +float MTTRoundValueToPixelGrid(float value, float scaleFactor, bool forceCeil, bool forceFloor) { + float scaleValue = value * scaleFactor; + float fractial = fmodf(scaleValue, 1.0); + if (fractial < 0) { + ++fractial; + } + if (FloatIsEqual(fractial, 0)) { // First we check if the value is already rounded - value = value - fractial; + scaleValue = scaleValue - fractial; } else if (FloatIsEqual(fractial, 1.0)) { - value = value - fractial + 1.0; + scaleValue = scaleValue - fractial + 1.0; } else if (forceCeil) { // Next we check if we need to use forced rounding - value = value - fractial + 1.0f; + scaleValue = scaleValue - fractial + 1.0f; } else if (forceFloor) { - value = value - fractial; + scaleValue = scaleValue - fractial; } else { // Finally we just round the value - value = roundf(value); - // value = value - fractial + - // (fractial > 0.5f || FloatIsEqual(fractial, 0.5f) ? 1.0f : 0.0f); + scaleValue = scaleValue - fractial + + (fractial > 0.5f || FloatIsEqual(fractial, 0.5f) ? 1.0f : 0.0f); } - return value; + return scaleValue / scaleFactor; } diff --git a/ios/sdk/layout/MTTUtil.h b/ios/sdk/layout/MTTUtil.h index 4da4f233848..d1403150117 100755 --- a/ios/sdk/layout/MTTUtil.h +++ b/ios/sdk/layout/MTTUtil.h @@ -58,4 +58,4 @@ bool FloatIsEqual(const float a, const float b); bool FloatIsEqualInScale(float a, float b, float scale); bool MTTSizeIsEqual(MTTSize a, MTTSize b); bool MTTSizeIsEqualInScale(MTTSize a, MTTSize b, float scale); -float MTTRoundValueToPixelGrid(float value, bool forceCeil, bool forceFloor); +float MTTRoundValueToPixelGrid(float value, float scaleValue, bool forceCeil, bool forceFloor);