Search code examples
nativescript

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


Help!. Compiler returns error

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

i am trying to get heightDIPs but this.


Solution

  • You might want to check where Screen is being imported from. I've had issues in the past where VS Code would auto import the wrong Screen.

    import { Screen } from '@nativescript/core';
    
    // and the following should work
    Screen.mainScreen.heightDIPs