NativeScript / nativescript-fresco

This repository holds the NativeScript plugin that exposes the functionality of the Fresco image library to NativeScript developers.
Apache License 2.0
53 stars 23 forks source link

[Question] Not displaying the image #54

Closed kamlekar closed 6 years ago

kamlekar commented 6 years ago

Hi, I am using this plugin to resolve the memory issues but the images are not displaying. Here is my code.

XML :

<android>
       <nativescript-fresco:FrescoDrawee imageUri="{{ filePath }}" width="{{ itemWidth }}" failureImageUri="res://layer19" placeholderImageUri="res://dress"/>
</android>

sample filePath looks like : https://dummy-url/123456/0.jpg

if (application.android) {
    application.on("launch", function () {
        fresco.initialize();
    });
}

Package.json :

{
    "description": "NativeScript Application",
    "license": "SEE LICENSE IN <your-license-filename>",
    "readme": "NativeScript Application",
    "repository": "<fill-your-repository-here>",
    "nativescript": {
        "tns-ios": {
            "version": "3.4.0"
        },
        "tns-android": {
            "version": "3.2.0"
        }
    },
    "dependencies": {
                     .... 
                     .... 
        "nativescript-fresco": "^3.0.6"
                     .... 
                     .... 
    }

P.S: I am including namespace in XML and the variables are initializing properly. I am not getting any errors. am I making any mistakes here? Thanks.

VladimirAmiorkov commented 6 years ago

It looks like you have set only the width of the FrescoDrawee, please read this section of the readme. In order for the FrescoDrawee to be shown you need to set its size, when you want to set only width or height you will need to provide the correct aspect ration and set it to the aspectRatio property. For example this demo shows how to set aspectRatio or this one.

nsplugins commented 6 years ago

Closing due to inactivity.