<OrientationSensor>
Tracks screen orientation using orientationchange
event.
Usage
import {OrientationSensor} from 'libreact/lib/OrientationSensor';
<OrientationSensor>(state) =>
<pre>{JSON.stringify(state, null, 4)}</pre>
</OrientationSensor>
Props
None.
State
Has signature
interface IOrientationSensorState {
angle: number;
type: string;
}
, where
angle
- screen rotation angle in degrees.type
- is one ofportrait-primary
,portrait-secondary
,landscape-primary
, orlandscape-secondary
.
withOrientation()
HOC
HOC that merges orientation
prop into enhanced component's props.
import {withOrientation} from 'libreact/lib/OrientationSensor';
@withOrientation
decorator
React stateful component decorator that adds orientation
prop.
import {withOrientation} from 'libreact/lib/OrientationSensor';
@withOrientation
class MyComp extends Component {
}