Skip to content

This repository holds the NativeScript plugin that exposes the functionality of the Fresco image library to NativeScript developers.

License

Notifications You must be signed in to change notification settings

martinjoshua/nativescript-fresco

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to nativescript-fresco

What is nativescript-fresco?

nativescript-fresco is a NativeScript plugin that exposes the Fresco library used for efficiently displaying images on Android. More information about what Fresco is and how it works is available on its official website here:

https://code.facebook.com/posts/366199913563917/introducing-fresco-a-new-image-library-for-android/

The nativescript-fresco plugin enables NativeScript developers to use the FrescoDrawee class which is extends the traditional Android ImageView component and adds the smart Fresco image management algorithms. The plugin exposes the drawee as a NativeScript view so you basically put it in the XML definition of your page and provide the URI to the image you would like to use.

How to use nativescript-fresco?

  1. Clone the repository and go to the root directory on your computer.
  2. Use tsc to transpile the .ts sources: tsc -p.
  3. Go to the root folder of your {N} application where you would like to install the plugin and type tns plugin add <path-to-fresco-repo-dir>.
  4. Initialize fresco in the launch event of your {N} application by using the following code:
var application = require("application");
if (application.android) {
    application.onLaunch = function (intent) {
        com.facebook.drawee.backends.pipeline.Fresco.initialize(application.android.context);
    };
}

Use fresco in the XML definition of the page as follows:

<Page
    xmlns="http://www.nativescript.org/tns.xsd" xmlns:f="fresco/fresco">
    <f:FrescoDrawee
        horizontalAlignment="stretch"
        height="250"
        imageUri="<uri-to-a-photo-from-the-web-or-a-local-resource>"/>
</Page>

About

This repository holds the NativeScript plugin that exposes the functionality of the Fresco image library to NativeScript developers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 60.6%
  • TypeScript 39.4%