Title: css-calc is broken i 6.1.0 · Issue #7786 · NativeScript/NativeScript · GitHub
Open Graph Title: css-calc is broken i 6.1.0 · Issue #7786 · NativeScript/NativeScript
X Title: css-calc is broken i 6.1.0 · Issue #7786 · NativeScript/NativeScript
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: 6.1.0 Cross-platform modules: 6.1.0 Android...
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: 6.1...
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: 6.1...
Opengraph URL: https://github.com/NativeScript/NativeScript/issues/7786
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"css-calc is broken i 6.1.0","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: 6.1.0\r\n - Cross-platform modules: 6.1.0\r\n - Android Runtime: \r\n - iOS Runtime:\r\n - Plugin(s):\r\n\r\n**Describe the bug**\r\n\u003c!-- A clear and concise description of what the bug is. Please, explain whether it's a build time error or a runtime error. More detailed logs can be easily obtained by following the instructions in this guide: https://docs.nativescript.org/get-support#how-to-obtain-diagnostic-reports. --\u003e\r\n\r\n**To Reproduce**\r\n\u003c!-- Add commands used or steps taken to reproduce the behaviour. --\u003e\r\n1. Create a new nativescript project: tns create --ng test\r\n2. Edit `src/app/item/items.component.ts`\r\n3. Add:\r\n```typescript\r\n styles: [`\r\n .page {\r\n --my-factor: 0.5;\r\n opacity: calc(1 * var(--my-factor));\r\n }\r\n `],\r\n```\r\n4: Get this error:\r\n```bash\r\nJS: Error: Failed to evaluate css-calc for property [opacity] for expression [calc(1 * 0.5)] to GridLayout(8). TypeError: reduce_css_calc_1.default is not a function\r\nJS: at Object._evaluateCssCalcExpression (file:///node_modules/tns-core-modules/ui/core/properties/properties.js:85:0)\r\nJS: at evaluateCssExpressions (file:///node_modules/tns-core-modules/ui/styling/style-scope.js:40:0)\r\nJS: at CssState.push.../node_modules/tns-core-modules/ui/styling/style-scope.js.CssState.setPropertyValues (file:///node_modules/tns-core-modules/ui/styling/style-scope.js:460:0)\r\nJS: at file:///node_modules/tns-core-modules/ui/styling/style-scope.js:381:0\r\nJS: at GridLayout.push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase._batchUpdate (file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:279:0)\r\nJS: at CssState.push.../node_modules/tns-core-modules/ui/styling/style-scope.js.CssState.updateDynamicState (file:///node_modules/tns-core-modules/ui/styling/style-scope.js:379:0)\r\nJS: at CssState.push.../...\r\n\r\n```\r\n\r\n**Expected behavior**\r\nNo error logged and `calc` evaluated.\r\n\r\n**Sample project**\r\n\u003c!-- If possible, provide a link from the [Playground](https://play.nativescript.org) with reproduction of the problem. If not, consider attaching a sample project or link to a repository with such project. --\u003e\r\n\r\n**Additional context**\r\n\u003c!-- Add any other context about the problem here. --\u003e\r\n\r\nIn `tns-core- modules@6.1.0` the file `node_modules/tns-core-modules/ui/core/properties/properties.js` tries to use the non-existing function `reduce_css_calc_1.default`\r\n\r\nThis is the javascript code as it is\r\n```javascript\r\nfunction _evaluateCssCalcExpression(value) {\r\n if (typeof value !== \"string\") {\r\n return value;\r\n }\r\n if (isCssCalcExpression(value)) {\r\n return reduce_css_calc_1.default(value.replace(/([0-9]+(\\.[0-9]+)?)dip\\b/g, \"$1\"));\r\n }\r\n else {\r\n return value;\r\n }\r\n}\r\n```\r\n\r\nIt should be\r\n```javascript\r\nfunction _evaluateCssCalcExpression(value) {\r\n if (typeof value !== \"string\") {\r\n return value;\r\n }\r\n if (isCssCalcExpression(value)) {\r\n return reduce_css_calc_1(value.replace(/([0-9]+(\\.[0-9]+)?)dip\\b/g, \"$1\"));\r\n }\r\n else {\r\n return value;\r\n }\r\n}\r\n```\r\n","author":{"url":"https://github.com/m-abs","@type":"Person","name":"m-abs"},"datePublished":"2019-09-05T14:06:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/7786/NativeScript/issues/7786"}
| 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:1ee800e8-cfcb-929b-aafe-7a72a0c5ca42 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC26:1E21D5:83189B:AE34FD:6971C4DB |
| html-safe-nonce | 5ddae763e7c0d73edd60824cd795e47b5deca48a3500733bb215400affd98f8a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzI2OjFFMjFENTo4MzE4OUI6QUUzNEZEOjY5NzFDNERCIiwidmlzaXRvcl9pZCI6IjYwNjUyODA3MDQ2NzkzNjM4MDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f38ce1dbb388bbaa5123e0330970f4472a8be5c645c25e2475845a8d1ffb7d21 |
| hovercard-subject-tag | issue:489777654 |
| 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/7786/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e6d21690f32ee91b90ab023d9b80f8ca5651bf785372d032793707c57e328377/NativeScript/NativeScript/issues/7786 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e6d21690f32ee91b90ab023d9b80f8ca5651bf785372d032793707c57e328377/NativeScript/NativeScript/issues/7786 |
| 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: 6.1... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | m-abs |
| hostname | github.com |
| expected-hostname | github.com |
| None | ac615aa66802dad9a938c6abe95edf09ee43c0c7f508315b64b08612858ef32e |
| 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 | 6b618569a5f93e0b31f97f620112341421ef5f69 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width