UNPKG

crn-cli

Version:

The Ctrip React Native CLI Tools

1 lines 1.06 kB
__d(function(g,r,i,a,m,e,d){'use strict';var n=r(d[0]),t=r(d[1]),s=r(d[2]),o=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]),h=u.Dimensions,f=u.Text,p=u.View,v=(function(u){function v(){var t,c;n(this,v);for(var l=arguments.length,u=new Array(l),f=0;f<l;f++)u[f]=arguments[f];return(c=s(this,(t=o(v)).call.apply(t,[this].concat(u)))).state={dims:h.get(c.props.dim)},c._handleDimensionsChange=function(n){c.setState({dims:n[c.props.dim]})},c}return c(v,u),t(v,[{key:"componentDidMount",value:function(){h.addEventListener('change',this._handleDimensionsChange)}},{key:"componentWillUnmount",value:function(){h.removeEventListener('change',this._handleDimensionsChange)}},{key:"render",value:function(){return l.createElement(p,null,l.createElement(f,null,JSON.stringify(this.state.dims)))}}]),v})(l.Component);e.title='Dimensions',e.description='Dimensions of the viewport',e.examples=[{title:'window',render:function(){return l.createElement(v,{dim:"window"})}},{title:'screen',render:function(){return l.createElement(v,{dim:"screen"})}}]},666772,[3,4,5,8,9,11,15]);