@wuilmerj24/screen-orientation
v1.0.6
Published
It gives you simple and effective control over your NativeScript app's screen orientation. With this plugin, you can easily manage how your user interface is displayed, adapting it to your app's specific needs.
Maintainers
Readme
@wuilmerj24/screen-orientation
npm install @wuilmerj24/screen-orientationUse
API
Methods
| Method | Description | | ------ | ----------- | | getOrientacion() | Gets the current screen orientation. | | setOrientacion(Orientacion) | Change the screen orientation. Returns a Promise. |
Supported orientation types
Orientation
| Orientation | Descriptions | | ----------- | ----------- | | ANY | Orientation is unlocked: all orientations are supported. | | PORTRAIT | Change the screen rotation to PORTRAIT mode. | | PORTRAIT_REVERSE | Change the screen rotation to PORTRAIT_REVERSE mode. | | LANDSCAPE | Change the screen rotation to LANDSCAPE mode | | LANDSCAPE_REVERSE | Change the screen rotation to LANDSCAPE_REVERSE mode | | UNSPECIFIED | Does not change orientation. |
Orientation types for Android only.
| Orientation | Description | | ----------- | ----------- | | PORTRAIT_SENSOR | Change the screen rotation to PORTRAIT_SENSOR mode when the mobile is rotated in PORTRAIT or PORTRAIT by rotating the screen 180°. | | LANDSCAPE_SENSOR | Change the screen rotation to LANDSCAPE_SENSOR mode when the mobile is rotated in LANDSCAPE or LANDSCAPE by rotating the screen 270°. |
Get the screen orientation
//Gets the current orientation in string format.
let orientacion = getOrientacion();Change the screen orientation
//change the orientation;
setOrientacion(Orientacion.ANY).then((res:boolean)=>{
console.log(res)
})License
Apache License Version 2.0
