FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Screen dimensions platform.android & platform.ios different · Issue #4588 · NativeScript/NativeScript · GitHub

Screen dimensions platform.android & platform.ios different #4588

Description

Dear friend, we, the rest of the NativeScript community really
appreciate your feedback! While we are doing all we can to take care of every
issue, sometimes we get overwhelmed. Because of that, we will consider issues
that are not constructive or problems that cannot be reproduced "dead".
Additionally, we will treat feature requests or bug reports with unanswered
questions regarding the behavior/reproduction for more than 20 days "dead". All
"dead" issues will get closed.

Please, provide the details below:

Did you verify this is a real problem by searching Stack Overflow and the other open issues in this repo?

Tell us about the problem

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

Which platform(s) does your issue occur on?

Different behavior on iOS/Android so I just wanted to check if this was planned.

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.1.2
  • Cross-platform modules: 3.1.0
  • Runtime(s): ios 3.1.0 & android 3.1.1
  • Plugin(s): see bottom for entire package.json

Please tell us how to recreate the issue in as much detail as possible.

I was using:
import { screen, device } from "platform";
and in ngOnInit method:
this.isLandscape = (screen.mainScreen.widthPixels > screen.mainScreen.heightPixels);
to determine if phone is in landscape or portrait mode and noticed different behavior between iOS and Android. This calculation is always correct on the initial page of my app, but the difference appears when navigating to the second page and using the same code to determine landscape or portrait.

  1. Starting on page 1 in portrait mode and then rotating phone to landscape.
  2. Then navigate to page 2:
    a) iOS will correctly compute this.isLandscape
    b) Android will not

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

I believe the reason for this is here.

Another solution has been implemented in the app to avoid this, but I wanted to check with NS team if this is planned/expected behavior. Thanks for your time and support!

My package.json:

{
  "name": "",
  "version": "0.0.2",
  "description": "",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "",
    "tns-android": {
      "version": "3.1.1"
    },
    "tns-ios": {
      "version": "3.1.0"
    }
  },
  "dependencies": {
    "@angular/common": "4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@angular/router": "4.1.3",
    "@ngrx/core": "1.2.0",
    "@ngrx/store": "2.2.2",
    "nativescript-angular": "3.1.1",
    "nativescript-camera": "3.0.0",
    "nativescript-google-analytics": "^0.3.7",
    "nativescript-imagepicker": "3.0.1",
    "nativescript-iqkeyboardmanager": "1.0.1",
    "nativescript-social-share": "1.3.2",
    "nativescript-telerik-ui": "3.0.1",
    "reflect-metadata": "^0.1.10",
    "rxjs": "5.4.2",
    "tns-core-modules": "3.1.0",
    "zone.js": "0.8.12"
  },
  "devDependencies": {
    "@angular/compiler-cli": "4.1.3",
    "@ngtools/webpack": "^1.3.0",
    "babel-traverse": "6.23.1",
    "babel-types": "6.23.0",
    "babylon": "6.16.1",
    "copy-webpack-plugin": "~3.0.1",
    "extract-text-webpack-plugin": "~2.0.0-beta.4",
    "lazy": "1.0.11",
    "nativescript-css-loader": "~0.26.0",
    "nativescript-dev-typescript": "^0.4.5",
    "nativescript-dev-webpack": "^0.3.6",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~1.6.0",
    "tns-platform-declarations": "3.1.0",
    "typescript": "^2.3.4",
    "webpack": "2.2.0",
    "webpack-sources": "~0.1.3"
  },
  "scripts": {
    "ns-bundle": "ns-bundle",
    "start-android-bundle": "npm run ns-bundle --android --start-app",
    "start-ios-bundle": "npm run ns-bundle --ios --start-app",
    "build-android-bundle": "npm run ns-bundle --android --build-app",
    "build-ios-bundle": "npm run ns-bundle --ios --build-app"
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL