NativeScript / docs

The NativeScript Docs!
https://docs.nativescript.org/
12 stars 23 forks source link

docs: ImageSource #46

Closed Ombuweb closed 1 year ago

Ombuweb commented 1 year ago

I need help with examples for ImageSource.fromData() and ImageSource.fromFontIconCodeSync(). I tried

const img = ImageSource.fromFontIconCodeSync("", new Font("serif", 12),new Color("red")) but it's not converting that string to an icon.

Ombuweb commented 1 year ago

When is it ideal to use fromAsset() ? It seems to achieve the same result as fromFile() but the latter being simpler.

rigor789 commented 1 year ago

When is it ideal to use fromAsset() ? It seems to achieve the same result as fromFile() but the latter being simpler.

Sometimes you have an ImageAsset instance you need to convert, for example when taking an image with the camera usually results in an ImageAsset, which you convert to ImageSource to display in the app. There are likely other cases where that's useful, but I can't think of any.

Ombuweb commented 1 year ago

I think the ImageAsset class has bugs. On iOS, the ios property returns undefined and the nativeImage property returnsundefined on Android.

Ombuweb commented 1 year ago

@rigor789 I think we should move ImageSource from /guide/core to /guide/ui/image-source. Then for the sidebar we can have following structure:

UI ...

...

rigor789 commented 1 year ago

/guide/ui/image-source sounds good 👍