1.0.0 • Published 2 years ago

@arepa/screen-orientation v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

screen-orientation

NativeScript Plugin change the screen orientation.

@arepa/screen-orientation

npm install @arepa/screen-orientation

Use

API

Methods

MethodDescription
getOrientacion()Obtiene la orientación actual de la pantalla" se traduce al inglés como "Gets the current screen orientation.
setOrientacion(Orientacion)Change the screen orientation. Returns a Promise.

Supported orientation types.

Orientation

OrientationDescriptions
ANYOrientation is unlocked: all orientations are supported.
PORTRAITChange the screen rotation to PORTRAIT mode.
PORTRAIT_REVERSEChange the screen rotation to PORTRAIT_REVERSE mode.
LANDSCAPEChange the screen rotation to LANDSCAPE mode
LANDSCAPE_REVERSEChange the screen rotation to LANDSCAPE_REVERSE mode
UNSPECIFIEDDoes 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)
})