mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor(core): zero circulars + esm ready (#10770)
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
import { Application } from '../../application';
|
||||
import { getNativeApp } from '../../application/helpers-common';
|
||||
|
||||
class MainScreen {
|
||||
private _metrics: android.util.DisplayMetrics;
|
||||
|
||||
private initMetrics(): void {
|
||||
const nativeApp = Application.android.getNativeApplication();
|
||||
const nativeApp = getNativeApp() as android.app.Application;
|
||||
nativeApp.getSystemService(android.content.Context.WINDOW_SERVICE).getDefaultDisplay().getRealMetrics(this._metrics);
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ios } from '../../utils';
|
||||
import { getWindow } from '../../utils/native-helper';
|
||||
|
||||
class MainScreen {
|
||||
private _screen: UIScreen;
|
||||
@ -6,7 +6,7 @@ class MainScreen {
|
||||
private get screen(): UIScreen {
|
||||
if (!this._screen) {
|
||||
// NOTE: may not want to cache this value with SwiftUI app lifecycle based apps (using NativeScriptViewFactory) given the potential of multiple scenes
|
||||
const window = ios.getWindow();
|
||||
const window = getWindow() as UIWindow;
|
||||
this._screen = window ? window.screen : UIScreen.mainScreen;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user