Skip to content
Image caching plugin for nativescript
TypeScript Java Vue HTML Shell CSS Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github V3 Jan 30, 2018
demo-ng chore(): update demo Oct 9, 2019
demo-vue feat(): vue support Oct 5, 2019
demo chore(): update demo Oct 9, 2019
publish feat(): V5 Jun 30, 2019
screenshots Fixed package build & Added screenshots Apr 17, 2016
src chore(): bump Oct 9, 2019
.gitignore feat(): vue support Oct 5, 2019
.prettierrc prettier config Mar 2, 2018
.travis.yml v4 Apr 18, 2018
CHANGELOG.md chore(): add changelog Dec 6, 2018
CODE_OF_CONDUCT.md
LICENSE
README.md
tslint.json

README.md

npm npm Build Status

Image-Cache-It

Glide - Android

SDWebImage - IOS

Install

NativeScript 4x

  • tns plugin add nativescript-image-cache-it

NativeScript 3x

  • tns plugin add nativescript-image-cache-it@3.0.7

NativeScript 2x

  • tns plugin add nativescript-image-cache-it@1.6.0

Usage

import { ImageCacheIt } from 'nativescript-image-cache-it';

Set image url to load.

load = image;

Set placeholder while images are downloading.

placeHolder = '~/assets/images/ph.png';

Set placeholder for images are that failed to download.

errorHolder = '~/assets/images/broken.png';

Set decoded image size.

decodedWidth = '300';
decodedHeight = '300';

Stretch

stretch = "aspectFit" // (optional) aspectFit || aspectFill || fill || none

Prefetch

import { ImageCacheIt } from 'nativescript-image-cache-it';
ImageCacheIt.fetchItem('https://source.unsplash.com/random').then(imageUrl =>{}).catch();

Delete item from cache

import { ImageCacheIt } from 'nativescript-image-cache-it';
ImageCacheIt.deleteItem('https://source.unsplash.com/random').then().catch();

Get item from cache

import { ImageCacheIt } from 'nativescript-image-cache-it';
ImageCacheIt.getItem('https://source.unsplash.com/random').then(imageUrl =>{}).catch();

e.g

import { ImageCacheIt } from 'nativescript-image-cache-it';
let cache = new ImageCacheIt();
cache.src = image;
cache.placeHolder = '~/assets/images/broken.png';
cache.errorHolder = '~/assets/images/ph.png';
cache.decodedWidth = '300';
cache.decodedHeight = '300';
cache.filter = 'blur(10px);';
cache.stretch = 'aspectFit';
return cache;

Xml markup settings

decodedWidth="300"; <!-- (optional) -->
decodedHeight="300"; <!-- (optional) -->
placeHolder="~/assets/images/ph.png" <!-- (optional) -->
errorHolder="~/assets/images/broken.png"  <!-- (optional) -->
stretch = "aspectFit" <!-- (optional) -->
src= "http://screenrant.com/wp-content/uploads/The-Flash-vs-the-Reverse-Flash.jpg" <!-- (required) -->

IMPORTANT: Make sure you include xmlns:i="nativescript-image-cache-it" on the Page element

e.g

<i:ImageCacheIt stretch="aspectFit"  resize="300,300" placeHolder="~/assets/images/ph.png" errorHolder="~/assets/images/broken.png" src="http://screenrant.com/wp-content/uploads/The-Flash-vs-the-Reverse-Flash.jpg"/>

Angular

import { TNSImageCacheItModule } from 'nativescript-image-cache-it/angular';

@NgModule({
    imports: [
    TNSImageCacheItModule
    ],
    declarations: [
        AppComponent
    ],
    bootstrap: [AppComponent]
})

Screenshots

Repeater

Image ImageCacheIt
image_repeater imagecacheit_repeater

ListView

Image ImageCacheIt
image_listview imagecacheit_listview
You can’t perform that action at this time.