mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix: expose orientation to application module (#7832)
This commit is contained in:
committed by
Manol Donev
parent
25046c7f94
commit
4166e2d966
@@ -248,6 +248,10 @@ export function getNativeApplication(): android.app.Application {
|
||||
return nativeApp;
|
||||
}
|
||||
|
||||
export function orientation(): "portrait" | "landscape" | "unknown" {
|
||||
return androidApp.orientation;
|
||||
}
|
||||
|
||||
on(orientationChangedEvent, (args: OrientationChangedEventData) => {
|
||||
const rootView = getRootView();
|
||||
if (rootView) {
|
||||
|
||||
@@ -285,6 +285,12 @@ export function on(event: "discardedError", callback: (args: DiscardedErrorEvent
|
||||
*/
|
||||
export function on(event: "orientationChanged", callback: (args: OrientationChangedEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* Gets the orientation of the application.
|
||||
* Available values: "portrait", "landscape", "unknown".
|
||||
*/
|
||||
export function orientation(): "portrait" | "landscape" | "unknown";
|
||||
|
||||
/**
|
||||
* This is the Android-specific application object instance.
|
||||
* Encapsulates methods and properties specific to the Android platform.
|
||||
|
||||
@@ -39,8 +39,8 @@ const Responder = (<any>UIResponder).extend({
|
||||
// NOOP
|
||||
}
|
||||
}, {
|
||||
protocols: [UIApplicationDelegate]
|
||||
}
|
||||
protocols: [UIApplicationDelegate]
|
||||
}
|
||||
);
|
||||
|
||||
class NotificationObserver extends NSObject {
|
||||
@@ -415,6 +415,10 @@ function setViewControllerView(view: View): void {
|
||||
}
|
||||
}
|
||||
|
||||
export function orientation(): "portrait" | "landscape" | "unknown" {
|
||||
return iosApp.orientation;
|
||||
}
|
||||
|
||||
on(orientationChangedEvent, (args: OrientationChangedEventData) => {
|
||||
const rootView = getRootView();
|
||||
if (rootView) {
|
||||
|
||||
Reference in New Issue
Block a user