Screen.setOrientation
Functional API
setDeviceOrientationYou can use the same function with this as well.
Feature description
Set the device screen orientation. Useful when forcing landscape/portrait mode on a specific screen.
Because it affects the entire app, if you want to use it only on a specific screen, restore the previous state when leaving that screen.
Toss app Android/iOS 5.215.0 It can be used on versions above. If called in an unsupported version, UNSUPPORTED_APP_VERSION an error occurs.
Type
Screen.setOrientation(options: SetDeviceOrientationOptions): Promise<void>;Params
type DeviceOrientation = "portrait" | "landscape";
interface SetDeviceOrientationOptions {
type: DeviceOrientation;
}Response
None.
Error code
The error code is the error.code value.
UNSUPPORTED_APP_VERSION
If the running version of the Toss app doesn't support this feature, it occurs immediately upon call. Screen.setOrientation.isSupported()Check in advance with error.messageand, if it occurs, show the user the (update guidance message).
Example code
Was this helpful?