Title: Cannot read property 'mainScreen' of undefined - when trying to get dark mode status · Issue #275 · NativeScript/theme · GitHub
Open Graph Title: Cannot read property 'mainScreen' of undefined - when trying to get dark mode status · Issue #275 · NativeScript/theme
X Title: Cannot read property 'mainScreen' of undefined - when trying to get dark mode status · Issue #275 · NativeScript/theme
Description: Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project): CLI: 7.0.8 Cross-platform modules: "@nativescrip...
Open Graph Description: Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project): CLI: 7.0...
X Description: Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project): CLI: 7.0...
Opengraph URL: https://github.com/NativeScript/theme/issues/275
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot read property 'mainScreen' of undefined - when trying to get dark mode status","articleBody":"**Environment**\r\nProvide version numbers for the following components (information can be retrieved by running `tns info` in your project folder or by inspecting the `package.json` of the project):\r\n - CLI: 7.0.8\r\n - Cross-platform modules: \"@nativescript/firebase\": \"rc\"\r\n - Android Runtime: -\r\n - iOS Runtime: \r\n```\r\nInstalling on device E2CFC71D-3295-443F-B505-B3B83D45553F...\r\nSuccessfully installed on device with identifier 'E2CFC71D-3295-443F-B505-B3B83D45553F'.\r\nRestarting application on device E2CFC71D-3295-443F-B505-B3B83D45553F...\r\nSuccessfully synced application org.nativescript.aaa on device E2CFC71D-3295-443F-B505-B3B83D45553F.\r\n(RunningBoardServices) [com.apple.runningboard:connection] Identity resolved as application\u003corg.nativescript.aaa\u003e\r\n***** Fatal JavaScript exception - application has been terminated. *****\r\nNativeScript encountered a fatal error: Uncaught TypeError: Cannot read property 'mainScreen' of undefined\r\nat\r\n../node_modules/@nativescript/theme/index.js(file: node_modules/@nativescript/theme/index.js:25:33)\r\nat __webpack_require__(file: app/webpack/bootstrap:74:0)\r\nat ../node_modules/babel-loader/lib/index.js!../node_modules/vue-loader/lib/index.js?!./components/Home.vue?vue\u0026type=script\u0026lang=js\u0026(file:///app/bundle.js:42:77)\r\nat __webpack_require__(file: app/webpack/bootstrap:74:0)\r\nat ./components/Home.vue?vue\u0026type=script\u0026lang=js\u0026(file: app/components/Home.vue?5625:1:0)\r\nat __webpack_require__(file: app/webpack/bootstrap:74:0)\r\nat ./components/Home.vue(file: app/components/Home.vue:1:0)\r\nat __webpack_require__(file: app/webpack/bootstrap:74:0)\r\nat (file: app/app.js:1:0)\r\nat ./app.js(file:///app/bundle.js:403:30)\r\nat __webpack_require__(file: app/webpack/bootstrap:74:0)\r\nat checkDeferredModules(file: app/webpack/bootstrap:43:0)\r\nat webpackJsonpCallback(file: app/webpack/bootstrap:30:0)\r\nat (file:///app/bundle.js:2:57)\r\nat require(:1:137)\r\n(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught TypeError: Cannot read property 'mainScreen' of undefined\r\nat\r\n../node_modules/@nativescript/theme/index.js(file: node_modules/@nativescript/theme/index.js:25:33)\r\nat __webpack_require__(file: app/webpack/bootstrap:74:0)\r\nat ../node_modules/babel-loader/lib/index.js!../node_modules/vue-loader/lib/index.js?!./components/Home.vue?vue\u0026type=script\u0026lang=js\u0026(file:///app/bundle.js:42:77)\r\nat __webpack_require__(file: app/webpack/bootstrap:74:0)\r\nat ./components/Home.vue?vue\u0026type=script\u0026lang=js\u0026(file: app/components/Home.vue?5625:1:0)\r\nat __webpack_require__(file: app/webpack/bootstrap:74:0)\r\nat ./components/Home.vue(file: app/components/Home.vue:1:0)\r\nat __webpack_require__(file: app/webpack/bootstrap:74:0)\r\nat (file: app/app.js:1:0)\r\nat ./app.js(file:///app/bundle.js:403:30)\r\nat __webpack_require__(file: app/webpack/bootstrap:74:0)\r\nat checkDeferredModules(file: app/webpack/bootstrap:43:0)\r\nat webpackJsonpCallback(file: app/webpack/bootstrap:30:0)\r\nat (file:///app/bu\u003c…\u003e\r\n\r\n```\r\n - Plugin(s):\r\n \"@nativescript/core\": \"~7.0.0\",\r\n \"@nativescript/firebase\": \"rc\",\r\n \"@nativescript/theme\": \"nativescript-vue\" (tried with rc also),\r\n \"nativescript-vue\": \"~2.8.0\"\r\n\r\n**Describe the bug**\r\nPretty much stock nativescript-vue installation with NativeScript CLI 7.0.8.\r\nIn my main screen I import the theme using `import Theme from \"@nativescript/theme\";`\r\nThen I'm trying to get the dark mode status like this:\r\n```\r\nmounted () {\r\n console.log(Theme.getMode())\r\n},\r\n```\r\nI get an error:\r\n`(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught TypeError: Cannot read property 'mainScreen' of undefined`\r\n\r\n**To Reproduce**\r\nJust try to use `Theme.getMode()` on NativeScript 7 with Vue (might be the same with others as well)\r\n\r\n**Expected behavior**\r\nHaven't used this feature before, I guess it will give you a string of \"ns-light\" or \"ns-dark\" and won't break your app.\r\n\r\n**Sample project**\r\nCan't reproduce this on play.nativescript.org as it uses the old NativeScript. As far as I've tested it seems to be the issue only with NativeScript 7\r\n","author":{"url":"https://github.com/butaminas","@type":"Person","name":"butaminas"},"datePublished":"2020-09-13T12:26:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/275/theme/issues/275"}
| 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:8c02d952-40b7-8e35-14e4-b5e57dafeab3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DD44:187D38:5EFC13:8937E2:6A62296A |
| html-safe-nonce | 3aa906faa402f9428c83ca2500935ce8e3ed9a6f361a7542cfd97d47911fd429 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDQ0OjE4N0QzODo1RUZDMTM6ODkzN0UyOjZBNjIyOTZBIiwidmlzaXRvcl9pZCI6IjQ2MDI2NzAwMDc2ODQ1NzM1NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1e911d7f39a93f296554225df4c3318d6ac8c4c3cf647d93a99d83c92791ab23 |
| hovercard-subject-tag | issue:700560589 |
| 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/theme/275/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e1c810f284a2636d42d95cc75071859955c5369632dd0bf9f4cd275180cbf120/NativeScript/theme/issues/275 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e1c810f284a2636d42d95cc75071859955c5369632dd0bf9f4cd275180cbf120/NativeScript/theme/issues/275 |
| og:image:alt | Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project): CLI: 7.0... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | butaminas |
| hostname | github.com |
| expected-hostname | github.com |
| None | 21839f35c93a14bc8ff43c34023894ded3dead0c48f637766489aed48b50c808 |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/theme git https://github.com/NativeScript/theme.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 64524068 |
| octolytics-dimension-repository_nwo | NativeScript/theme |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 64524068 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/theme |
| 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 | f870b4bd550634487383a2b5db62e680537bec89 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width