Title: widthPixels of "tns-core-modules/platform" is incorrect inside the orientationChanged event · Issue #6314 · NativeScript/NativeScript · GitHub
Open Graph Title: widthPixels of "tns-core-modules/platform" is incorrect inside the orientationChanged event · Issue #6314 · NativeScript/NativeScript
X Title: widthPixels of "tns-core-modules/platform" is incorrect inside the orientationChanged event · Issue #6314 · NativeScript/NativeScript
Description: Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo? Yes Tell us about the problem Using the screen.mainScreen.widthPixels from "tns-core-modules/platform" inside the applicati...
Open Graph Description: Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo? Yes Tell us about the problem Using the screen.mainScreen.widthPixels from "tns-cor...
X Description: Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo? Yes Tell us about the problem Using the screen.mainScreen.widthPixels from "tn...
Opengraph URL: https://github.com/NativeScript/NativeScript/issues/6314
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"widthPixels of \"tns-core-modules/platform\" is incorrect inside the orientationChanged event","articleBody":"### Did you verify this is a real problem by searching the [NativeScript Forum](http://forum.nativescript.org) and the [other open issues in this repo](https://github.com/NativeScript/nativescript/issues)?\r\nYes\r\n\r\n### Tell us about the problem\r\nUsing the `screen.mainScreen.widthPixels` from `\"tns-core-modules/platform\"` inside the application `orientationChanged`\r\n event returns the previous orientation's size. \r\n\r\n### Which platform(s) does your issue occur on?\r\nTested on Android\r\n\r\n### Please provide the following version numbers that your issue occurs with:\r\n- CLI: (run `tns --version` to fetch it)\r\n- Cross-platform modules: 4.2.0\r\n- Runtime(s): 4.2.0\r\n- Plugin(s): (look for the version number in the `package.json` file of your\r\nproject)\r\n```\r\n\"dependencies\": {\r\n \"@angular/common\": \"~6.1.0\",\r\n \"@angular/compiler\": \"~6.1.0\",\r\n \"@angular/core\": \"~6.1.0\",\r\n \"@angular/forms\": \"~6.1.0\",\r\n \"@angular/http\": \"~6.1.0\",\r\n \"@angular/platform-browser\": \"~6.1.0\",\r\n \"@angular/platform-browser-dynamic\": \"~6.1.0\",\r\n \"@angular/router\": \"~6.1.0\",\r\n \"@ngrx/store\": \"4.1.1\",\r\n \"nativescript-angular\": \"^6.0.0\",\r\n \"nativescript-camera\": \"4.0.2\",\r\n \"nativescript-floatingactionbutton\": \"4.1.3\",\r\n \"nativescript-fresco\": \"4.0.0\",\r\n \"nativescript-google-analytics\": \"0.4.4\",\r\n \"nativescript-image-swipe\": \"3.0.0\",\r\n \"nativescript-imagepicker\": \"6.0.3\",\r\n \"nativescript-iqkeyboardmanager\": \"1.1.0\",\r\n \"nativescript-orientation\": \"^2.2.0\",\r\n \"nativescript-toasty\": \"^1.1.5\",\r\n \"nativescript-ui-listview\": \"^3.5.11\",\r\n \"nativescript-ui-sidedrawer\": \"^4.3.0\",\r\n \"reflect-metadata\": \"0.1.10\",\r\n \"rxjs\": \"~6.1.0\",\r\n \"rxjs-compat\": \"^6.2.2\",\r\n \"tns-core-modules\": \"^4.2.0\",\r\n \"zone.js\": \"^0.8.26\"\r\n },\r\n \"devDependencies\": {\r\n \"@angular/compiler-cli\": \"~6.1.0\",\r\n \"@ngtools/webpack\": \"~6.1.0\",\r\n \"nativescript-dev-typescript\": \"~0.7.2\",\r\n \"nativescript-dev-webpack\": \"^0.15.1\",\r\n \"tns-platform-declarations\": \"4.2.0\",\r\n \"typescript\": \"~2.8.2\"\r\n },\r\n```\r\n\r\n### Please tell us how to recreate the issue in as much detail as possible.\r\nAttach to the application's `orientationChangedEvent` and try to retrieve the screen's width in Pixels\r\n`import * as applicationModule from 'tns-core-modules/application';`\r\n\r\n```\r\nimport { screen } from \"tns-core-modules/platform\";\r\n...\r\nconst screeWidth = screen.mainScreen.widthPixels\r\n```\r\n\r\n### Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.\r\n\r\n\r\n\r\n\r\n\r\n\u003cbountysource-plugin\u003e\r\n\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/63960575-widthpixels-of-tns-core-modules-platform-is-incorrect-inside-the-orientationchanged-event?utm_campaign=plugin\u0026utm_content=tracker%2F12908224\u0026utm_medium=issues\u0026utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin\u0026utm_content=tracker%2F12908224\u0026utm_medium=issues\u0026utm_source=github).\r\n\u003c/bountysource-plugin\u003e","author":{"url":"https://github.com/VladimirAmiorkov","@type":"Person","name":"VladimirAmiorkov"},"datePublished":"2018-09-27T14:37:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/6314/NativeScript/issues/6314"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:73006a56-d9bd-b1b7-2853-55253331dd50 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A9FC:1B9F72:14DB13:1BA823:6A5BBCBA |
| html-safe-nonce | e6fc5dc6e0b13253991ab6476637621ad22ef1c3435dba53f1d47d133b35152c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUZDOjFCOUY3MjoxNERCMTM6MUJBODIzOjZBNUJCQ0JBIiwidmlzaXRvcl9pZCI6IjQwMDc1NTI1NjE2OTE5OTk0MTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c8f31de44d93cba5e300312580b6753fd3cd4b78fb60dd1e6c000eab3d150cc0 |
| hovercard-subject-tag | issue:364508819 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/NativeScript/6314/issue_layout |
| twitter:image | https://opengraph.githubassets.com/be6705d9443dedea2af8b189d077aea8acb7722b510cfeaa5568eae6c07b1d7a/NativeScript/NativeScript/issues/6314 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/be6705d9443dedea2af8b189d077aea8acb7722b510cfeaa5568eae6c07b1d7a/NativeScript/NativeScript/issues/6314 |
| og:image:alt | Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo? Yes Tell us about the problem Using the screen.mainScreen.widthPixels from "tns-cor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | VladimirAmiorkov |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 31492490 |
| octolytics-dimension-repository_nwo | NativeScript/NativeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31492490 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/NativeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width