nativescript-community / ui-canvas

Implement Canvas into your NativeScript apps.
https://nativescript-community.github.io/ui-canvas/
Apache License 2.0
31 stars 9 forks source link

ReferenceError: UIDrawingText is not defined #22

Closed MartinPenev closed 3 years ago

MartinPenev commented 3 years ago

When drawing text, I'm receiving the following error only on iOS (both in the simulator and on-device). On Android, everything is working as expected.

ReferenceError: UIDrawingText is not defined at Canvas.drawText (file: node_modules/@nativescript-community/ui-canvas/canvas.ios.js:1572:0) at Canvas.descriptor.value (file: node_modules/@nativescript-community/ui-canvas/canvas.ios.js:50:0) at file: src/app/feature/cards/card-view/card-view.component.ts:263:13 at Array.forEach () at CardViewComponent.draw (file: src/app/feature/cards/card-view/card-view.component.ts:262:11) at CardViewComponent.renderDzi (file: src/app/feature/cards/card-view/card-view.component.ts:74:11) at CardViewComponent. (file: src/app/feature/cards/card-view/card-view.component.ts:223:11) at Generator.next () at file: node_modules/tslib/tslib.es6.js:74:0

Any clues what I'm doing wrong?

farfromrefug commented 3 years ago

@MartinPenev what version are you using ? Should be working with the latest one. Please share your package.json

MartinPenev commented 3 years ago
"dependencies": {
    "@angular/animations": "~10.1.0",
    "@angular/common": "~10.1.0",
    "@angular/compiler": "~10.1.0",
    "@angular/core": "~10.1.0",
    "@angular/forms": "~10.1.0",
    "@angular/platform-browser": "~10.1.0",
    "@angular/platform-browser-dynamic": "~10.1.0",
    "@angular/router": "~10.1.0",
    "@nativescript-community/ui-canvas": "^4.0.8",
    "@nativescript/angular": "~10.1.0",
    "@nativescript/camera": "^5.0.0",
    "@nativescript/core": "~7.0.3",
    "@nativescript/imagepicker": "^1.0.0",
    "@nativescript/theme": "~2.3.0",
    "@ngx-translate/core": "^13.0.0",
    "nativescript-camera": "^4.5.0",
    "nativescript-http-formdata": "^2.1.0",
    "nativescript-iqkeyboardmanager": "^1.5.1",
    "nativescript-paint": "^1.0.0",
    "nativescript-phone": "^2.0.0",
    "nativescript-plugin-firebase-updated": "^2110.4.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.6.0",
    "zone.js": "~0.11.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~10.1.0",
    "@nativescript/android": "7.0.0",
    "@nativescript/ios": "7.0.0",
    "@nativescript/types": "^7.0.3",
    "@nativescript/webpack": "~3.0.0",
    "@ngtools/webpack": "~10.1.0",
    "@types/node": "^14.10.1",
    "typescript": "~3.9.0"
  },

I have added your plugin with

tns plugin add @nativescript-community/ui-canvas

as suggested in the readme. Also in the package lock I can see version 4.0.8.

    "@nativescript-community/ui-canvas": {
      "version": "4.0.8",
      "resolved": "https://registry.npmjs.org/@nativescript-community/ui-canvas/-/ui-canvas-4.0.8.tgz",
      "integrity": "sha512-r5Q+UdmhkdPVYVTHBwTkaQXcA9mgSMgC2/pJLxqSFGshDneH5uytY6Tvsk48m8CIabDyDoc02XdI2zDgGas2vg=="
    },
farfromrefug commented 3 years ago

There is a 4.0.9 normally. Can you make sure you are using it ?

MartinPenev commented 3 years ago

Ah, ok, let me check!

MartinPenev commented 3 years ago

Hm, I can see it is 4.0.9, but I'm unable to install it. Is it published to npm?

Here https://www.npmjs.com/package/@nativescript-community/ui-canvas and here https://registry.npmjs.org/@nativescript-community/ui-canvas/ the latest is 4.0.8.

farfromrefug commented 3 years ago

Something must be wrong on my side. I ll look at it tomorrow

MartinPenev commented 3 years ago

@farfromrefug Thank you for the quick responses and for the great plugin again! Great job! Looking forward to 4.0.9 :+1:

farfromrefug commented 3 years ago

@MartinPenev just released 4.0.10 which should fix it! Let me know

MartinPenev commented 3 years ago

Works perfect, thanks! :+1: