crn-cli
Version:
The Ctrip React Native CLI Tools
1 lines • 1.18 kB
JavaScript
__d(function(g,r,i,a,m,e,d){'use strict';var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]),h=u.DeviceEventEmitter,p=u.Text,f=u.View,v=(function(u){function v(){var t,c;n(this,v);for(var l=arguments.length,u=new Array(l),h=0;h<l;h++)u[h]=arguments[h];return(c=o(this,(t=s(v)).call.apply(t,[this].concat(u)))).state={currentOrientation:'',orientationDegrees:0,isLandscape:!1},c._onOrientationChange=function(n){c.setState({currentOrientation:n.name,orientationDegrees:n.rotationDegrees,isLandscape:n.isLandscape})},c}return c(v,u),t(v,[{key:"componentDidMount",value:function(){this._orientationSubscription=h.addListener('namedOrientationDidChange',this._onOrientationChange)}},{key:"componentWillUnmount",value:function(){this._orientationSubscription.remove()}},{key:"render",value:function(){return l.createElement(f,null,l.createElement(p,null,JSON.stringify(this.state)))}}]),v})(l.Component);e.title='OrientationChangeExample',e.description='listening to orientation changes',e.examples=[{title:'OrientationChangeExample',description:'listening to device orientation changes',render:function(){return l.createElement(v,null)}}]},666783,[3,4,5,8,9,11,15]);