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

"..../node_modules/nativescript-canvas/canvas"' has no exported member 'CanvasView' #1

Closed otis78 closed 5 years ago

otis78 commented 5 years ago

Environment:
tns version 5.2.0 with Angular 7.2.5.

I install the plugin and import it as you wrote in the readme:

import { registerElement } from 'nativescript-angular/element-registry';
import { CanvasView } from 'nativescript-canvas';
registerElement('CanvasView', () => CanvasView);

But I have the error:

"..../node_modules/nativescript-canvas/canvas"' has no exported member 'CanvasView'

Did I miss something?
Thanks

farfromrefug commented 5 years ago

Which platform?

otis78 commented 5 years ago

For both iOS and Android platform.

farfromrefug commented 5 years ago

I see nothing wrong with your code. Please try 1.0.2 to see. If not please try the demo app with the plugin repo

otis78 commented 5 years ago

I tryed the 1.0.2 version but nothing changed.

I try to remove comment at line 5 of your file canvas.d.ts and the problem disappear but i don't know if

farfromrefug commented 5 years ago

@otis78 changing the d.ts file should not have any consequence at runtime. It's only for signature at compilation. This should not change anything. Something might be wrong with your setup. Have you tried the demo from this repo?

otis78 commented 5 years ago

This afternoon I also tryed to remove the comment from line 5 of canvas.d.ts export * from './canvas.android' and the import works and build correctly.

Now I'm trying the drawRect but in iOS i see only a black box with the same size of the canvas and in Android I can't see it at all. But I need more investigation.

I thing this issue can be closed here. I will open an other if needed.

Sorry for the demo that is written with Vue but I need the Angular version...I'm creating one. When I will be sure that all works I can a pull request if you want.

farfromrefug commented 5 years ago

@otis78 canyou try the latest version? also about the actaual rectangle drawing, are you sure you are using it the right way? you look at the demo or the android canvas doc to see how it works

otis78 commented 5 years ago

Hi @farfromrefug, I tryed the latest version and the import problem is solved. Thanks.

About drawing issue. Comparing my code with your demo I partially solved. The plugin is working. I can see the draw in both platform. But will I open an issue about the canvas size. In Android the size is not the expected.

farfromrefug commented 5 years ago

Ok so i close this one