编译器错误 screen.mainScreen 是类型 'Screen' 的静态成员

Compiler error screen.mainScreen is a static member of type 'Screen'

求助!编译器 returns 错误

Property 'mainScreen' is a static member of type 'Screen'

我正在尝试获取 heightDIPs 但是这个。

您可能想检查 Screen 是从哪里导入的。我过去遇到过 VS Code 会自动导入错误的问题 Screen.

import { Screen } from '@nativescript/core';

// and the following should work
Screen.mainScreen.heightDIPs