1.0.7 • Published 4 months ago

@wuilmerj24/gallery-view v1.0.7

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 months ago

@wuilmerj24/gallery-view

npm install @wuilmerj24/gallery-view

Note: For the moment, it only supports images

Usage

Core: Add xmlns:gv="@wuilmerj24/gallery-view" to you_view.xml example:

<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:gv="@wuilmerj24/gallery-view" navigatingTo="navigatingTo" class="page">
    <Page.actionBar>
        <ActionBar title="gallery-view" icon="" class="action-bar">
        </ActionBar>
    </Page.actionBar>
    <StackLayout>
      <gv:GalleryView
          width="100%"
          height="100%"
          albunInit="camera"
          debug="true"
          language="es"
          file_type="image"
          showHeader="true"
          bgColorHeader="gray"
          textcolorHeader="white"
          maxItemSelect="5"
          showFooter="true"
          bgColorFooter="gray"
          textColorFooter="white"
          edit="true"
          preview="true"
          loaded="onLoad"
          errorEvent="onError"
          scroll="onScroll"
            click="onClick"
      />
    </StackLayout>
</Page>

Angular Import in your component module or app module

import {NativeScriptGalleryViewModule} from "@wuilmerj24/gallery-view/angular"

@NgModule({
  imports: [
    NativeScriptGalleryViewModule // this line
  ],
  declarations: [GalleryViewComponent],
  schemas: [NO_ERRORS_SCHEMA],
})
export class AppModule {}
<GalleryView 
    width="100%" 
    height="100%"
    debug="true"
    language="es"
    file_type="image"
    showHeader="true"
    bgColorHeader="gray"
    textcolorHeader="white"
    maxItemSelect="5"
    showFooter="true"
    bgColorFooter="gray"
    textColorFooter="white"
    edit="true"
    preview="true"
    (loaded)="onLoad($event)"
    (errorEvent)="onError($event)"
    (scroll)="onScroll($event)"
    (click)="onClick($event)"
  >

  </GalleryView>

Attributes

AttributeTypeDefault
debugbooleanfalse
languageELanguagees
file_typeEFileTypeimage
showHeaderbooleantrue
bgColorHeaderstringhex color or string color
textcolorHeaderstringhex color or string color
maxItemSelectnumber1
showFooterbooleantrue
bgColorFooterstringhex color or string color
textColorFooterstringhex color or string color
editbooleanfalse
previewbooleantrue

Events

EventParamsDescription
loadedonLoad(args: GalleryViewLoadedEvent)Fired on GalleryView is loaded
errorEventonError(args: ErrorEvent)Fired error on show GalleryView
scrollonScroll(args: OnScrolledEvent)Fired to scroll event and return array all files
clickonClick(args: OnClickedEvent)Fired on click inside item

Interfaces

export interface IFiles {
  id: string;
  albunName: string;
  data: Array<IFileData>;
  isSelected: boolean;
  icon: string;
}

export interface IFileData {
  id: string;
  uri: string;
  isSelected: boolean;
  info?: any;
}

Examples use

<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:gv="@wuilmerj24/gallery-view" navigatingTo="navigatingTo" class="page">
    <Page.actionBar>
        <ActionBar title="gallery-view" icon="" class="action-bar">
        </ActionBar>
    </Page.actionBar>
    <StackLayout>
      <gv:GalleryView 
          width="100%" 
          height="100%"
          debug="true"
          language="es"
          file_type="image"
          showHeader="true"
          bgColorHeader="gray"
          textcolorHeader="white"
          maxItemSelect="5"
          showFooter="true"
          bgColorFooter="gray"
          textColorFooter="white"
          edit="true"
          preview="true"
          loaded="onLoad"
          errorEvent="onError"
          scroll="onScroll"
            click="onClick"
      />
    </StackLayout>
</Page>
export function onLoad(args: GalleryViewLoadedEvent) {
  console.log('load ');
}

export function onError(args: ErrorEvent) {
  console.log('error ');
}

export function onClick(args: OnClickedEvent) {
  console.log('click ',args.data);
}

export function onScroll(args: OnScrolledEvent) {
  console.log('scroll ',args.data);
}

License

Apache License Version 2.0