Skip to main content

setScreenOrientation

setScreenOrientation

Locks the screen orientation while this form is open.

Parameters

  • orientation (string | string[]): The orientation token, or an array of tokens, to allow

Allowed tokens:

  • 'portrait' — portrait (portraitUp + portraitDown)
  • 'landscape' — landscape (landscapeLeft + landscapeRight)
  • 'portraitUp' — portrait, upright
  • 'portraitDown' — portrait, upside down
  • 'landscapeLeft' — landscape, rotated left
  • 'landscapeRight' — landscape, rotated right
  • 'auto' or an empty array [] — releases the lock

Returns: None (void)

Description

Restricts the screen to the given orientation while this form is active. When the form closes — including via back navigation or a slide-back gesture — the restriction automatically reverts to auto (released).

info

Effective on mobile (Android / iOS) only. It's ignored on desktop.

Example

// 가로 모드로 고정
$form.setScreenOrientation("landscape");

// 세로 정방향만 허용
$form.setScreenOrientation("portraitUp");

// 복수 방향 허용
$form.setScreenOrientation(["portraitUp", "landscapeLeft"]);

// 방향 잠금 해제
$form.setScreenOrientation("auto");