nativescript-community / ui-image

Advanced and efficient image display plugin which uses Fresco (Android) and SDWebImage (iOS) to implement caching, placeholders, image effects, and much more.
Apache License 2.0
36 stars 9 forks source link

Svelte native errors and help needed #40

Closed sido420 closed 8 months ago

sido420 commented 3 years ago

I am using Svelte native with this plugin. Whereas most/all plugin work with Svelte native but this one isn't.

I cannot put the attribute in and without that the tag is not working in code. VS Code complains with "Expected valid tag name".

I know svelte is not officially supported but this a community plugin so I thought I might get some help here.

farfromrefug commented 3 years ago

I use it without any problem in svelte. you should ask those kind of questions in slack or on discord. without code it is hard to help you

sido420 commented 3 years ago

@farfromrefug Thanks for your response.

I got it working on NS 6.7.8, but I was trying with the latest which did not work.

Can you share the channel names plz?

farfromrefug commented 3 years ago

@sido420 it s on nativescript website (dont have it right now)

ferdavs commented 3 years ago

@farfromrefug could you put an example for svelte? probably we have to register an element with registerElement but could not figure out what to register.

farfromrefug commented 3 years ago

@ferdavs

registerNativeViewElement('image', () => require('@nativescript-community/ui-image').Img);
ferdavs commented 3 years ago

@farfromrefug thank you. it works

ferdavs commented 3 years ago

for completeness

register with

registerNativeViewElement("imgCache", () => require("@nativescript-community/ui-image").Img);

initilize with

const imageModule = require('@nativescript-community/ui-image');
Application.on(Application.launchEvent, () => {
    imageModule.initialize({ isDownsampleEnabled: true })
});