{"id":15587447,"url":"https://github.com/peterstaev/nativescript-image-swipe","last_synced_at":"2025-10-06T08:18:46.521Z","repository":{"id":57308582,"uuid":"90531011","full_name":"PeterStaev/nativescript-image-swipe","owner":"PeterStaev","description":"A NativeScript widget to easily :point_up_2: and  :mag: through a list of images","archived":false,"fork":false,"pushed_at":"2019-08-07T13:44:49.000Z","size":6631,"stargazers_count":35,"open_issues_count":14,"forks_count":21,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-24T04:48:43.252Z","etag":null,"topics":["android","image-swipe","ios","nativescript","swipe","tangra","ui","widget","zoom"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PeterStaev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-07T12:29:42.000Z","updated_at":"2024-05-30T15:56:31.000Z","dependencies_parsed_at":"2022-08-29T02:51:42.941Z","dependency_job_id":null,"html_url":"https://github.com/PeterStaev/nativescript-image-swipe","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterStaev%2Fnativescript-image-swipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterStaev%2Fnativescript-image-swipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterStaev%2Fnativescript-image-swipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterStaev%2Fnativescript-image-swipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PeterStaev","download_url":"https://codeload.github.com/PeterStaev/nativescript-image-swipe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250566443,"owners_count":21451230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","image-swipe","ios","nativescript","swipe","tangra","ui","widget","zoom"],"created_at":"2024-10-02T22:01:48.473Z","updated_at":"2025-10-06T08:18:41.480Z","avatar_url":"https://github.com/PeterStaev.png","language":"TypeScript","readme":"__The author of this plugin will continue to support it in a separate repo exclusively as part of [ProPlugins](https://proplugins.org). This repo will remain supported by the NativeScript community.__\n\n# Contribution - help wanted\nThis plugin is supported by the NativeScript community. All PRs are welcome but make sure that the demo applications work correctly before creating a new PR. If you do not have an issue you are facing but want to contribute to this plugin you can find a list of the on going issues [here](https://github.com/PeterStaev/nativescript-image-swipe/issues).\n\n## Creating a PR checklist:\n- Fork the repo\n- Add new functionality or fix an issue and push it to your fork\n- Start both demo and demo-ng apps and make sure they work correctly (make sure that no console errors are thrown on both iOS and Android)\n- From your fork create a PR targeting the 'master' branch of this repository\n\nThank you for your contribution.\n\n# NativeScript Image Swipe widget \n[![Build Status](https://travis-ci.org/PeterStaev/nativescript-image-swipe.svg?branch=master)](https://travis-ci.org/PeterStaev/nativescript-image-swipe)\n[![npm downloads](https://img.shields.io/npm/dm/nativescript-image-swipe.svg)](https://www.npmjs.com/package/nativescript-image-swipe)\n[![npm downloads](https://img.shields.io/npm/dt/nativescript-image-swipe.svg)](https://www.npmjs.com/package/nativescript-image-swipe)\n[![npm](https://img.shields.io/npm/v/nativescript-image-swipe.svg)](https://www.npmjs.com/package/nativescript-image-swipe)\n\nA NativeScript widget that will allow you to easily swipe and zoom through a list of images. \n\n## Screenshot\n![Screenshot](https://raw.githubusercontent.com/PeterStaev/nativescript-image-swipe/master/docs/image-swipe.gif)\n\n## Installation\nRun the following command from the root of your project:\n\n`tns plugin add nativescript-image-swipe`\n\nThis command automatically installs the necessary files, as well as stores nativescript-image-swipe as a dependency in your project's package.json file.\n\n## Configuration\nThere is no additional configuration needed!\n\n## API\n\n### Events\n* **pageChanged**  \nTriggered when the user swipes to the next/previous image in the list. \n\n### Static Properties\n* **pageChangedEvent** - *String*  \nString value used when hooking to pageChanged event.\n\n### Instance Properties\n* **ios** - *[UIScrollView](https://developer.apple.com/reference/uikit/uiscrollview)*  \nGets the native iOS view that represents the user interface for this component. Valid only when running on iOS.\n\n* **android** - *[android.support.v4.view.ViewPager](https://developer.android.com/reference/android/support/v4/view/ViewPager.html)*  \nGets the native android widget that represents the user interface for this component. Valid only when running on Android OS.\n\n* **items** - *Array | ObservableArray*  \nGets or sets the items collection of the ImageSwipe. The items property can be set to an array or an object defining length and getItem(index) method.\n\n* **pageNumber** - *Number*  \nGets or sets the currently visible image.\n\n* **imageUrlProperty** - *string*  \nGets or sets the property inside the items' object that defines the Url from where to load the images\n\n* **allowZoom** - *boolean (default: true)*  \nGets or sets whether zoom is enabled\n\n## Usage\nYou need to add `xmlns:is=\"nativescript-image-swipe\"` to your page tag, and then simply use `\u003cis:ImageSwipe/\u003e` in order to add the widget to your page.\n```xml\n\u003c!-- test-page.xml --\u003e\n\u003cPage xmlns=\"http://schemas.nativescript.org/tns.xsd\" xmlns:is=\"nativescript-image-swipe\" navigatingTo=\"navigatingTo\"\u003e\n    \u003cGridLayout\u003e\n        \u003cis:ImageSwipe items=\"{{ items }}\" imageUrlProperty=\"imageUrl\" \n                       pageNumber=\"{{ pageNumber }}\" pageChanged=\"pageChanged\" backgroundColor=\"#000000\"\u003e\n        \u003c/is:ImageSwipe\u003e\n    \u003c/GridLayout\u003e\n\u003c/Page\u003e\n```\n\n```typescript\n// test-page.ts\nimport { EventData, Observable } from \"data/observable\";\nimport { ObservableArray } from \"data/observable-array\";\nimport { Page } from \"ui/page\";\n\nimport { PageChangeEventData } from \"nativescript-image-swipe\";\n\nlet viewModel: Observable;\n\nexport function navigatingTo(args: EventData) {\n    const page = args.object as Page;\n    const items = new ObservableArray();\n\n    items.push({ imageUrl: \"http://something.com/picture1.jpg\" });\n    items.push({ imageUrl: \"http://something.com/picture2.jpg\" });\n    items.push({ imageUrl: \"http://something.com/picture3.jpg\" });\n    items.push({ imageUrl: \"http://something.com/picture4.jpg\" });\n    items.push({ imageUrl: \"http://something.com/picture5.jpg\" });\n\n    viewModel = new Observable();\n    viewModel.set(\"items\", items);\n    viewModel.set(\"pageNumber\", 3);\n\n    page.bindingContext = viewModel;\n}\n\nexport function pageChanged(e: PageChangeEventData) {\n    console.log(`Page changed to ${e.page}.`);\n}\n```\n\n## Usage in Angular\nIn order to use the `ImageSwipe` you must register it in **BOTH** your `main.ts` and `main.aot.ts`!\n\n```typescript\n// main.ts\nimport { platformNativeScriptDynamic } from \"nativescript-angular/platform\";\nimport { registerElement } from \"nativescript-angular/element-registry\";\n\nimport { AppModule } from \"./app.module\";\n\nregisterElement(\"ImageSwipe\", () =\u003e require(\"nativescript-image-swipe/image-swipe\").ImageSwipe);\n\nplatformNativeScriptDynamic().bootstrapModule(AppModule);\n```\n\n```html\n\u003c!-- test.component.html --\u003e\n\u003cGridLayout\u003e\n    \u003cImageSwipe [items]=\"items\" imageUrlProperty=\"imageUrl\" \n                [pageNumber]=\"pageNumber\" (pageChanged)=\"pageChanged($event)\" backgroundColor=\"#000000\"\u003e\n    \u003c/ImageSwipe\u003e\n\u003c/GridLayout\u003e\n```\n\n```typescript\n// test.component.ts\nimport { Component, OnInit } from \"@angular/core\";\nimport { PageChangeEventData } from \"nativescript-image-swipe\";\n\n@Component({\n    selector: \"demo\",\n    moduleId: module.id,\n    templateUrl: \"./test.component.html\",\n})\nexport class ImageSwipeComponent implements OnInit {\n    public items: any[] = [];\n    public pageNumber: number = 3;\n\n    ngOnInit(): void {\n        this.items.push({ imageUrl: \"http://something.com/picture1.jpg\" });\n        this.items.push({ imageUrl: \"http://something.com/picture2.jpg\" });\n        this.items.push({ imageUrl: \"http://something.com/picture3.jpg\" });\n        this.items.push({ imageUrl: \"http://something.com/picture4.jpg\" });\n        this.items.push({ imageUrl: \"http://something.com/picture5.jpg\" });\n    }\n\n    public pageChanged(e: PageChangeEventData) {\n        console.log(`Page changed to ${e.page}.`);\n    }\n}\n```\n\n## Demos\nThis repository includes both Angular and plain NativeScript demos. In order to run those execute the following in your shell:\n```shell\n$ git clone https://github.com/peterstaev/nativescript-image-swipe\n$ cd nativescript-image-swipe\n$ npm install\n$ npm run demo-ios\n```\nThis will run the plain NativeScript demo project on iOS. If you want to run it on Android simply use the `-android` instead of the `-ios` sufix. \n\nIf you want to run the Angular demo simply use the `demo-ng-` prefix instead of `demo-`. \n\n## Donate\n[![Donate](https://img.shields.io/badge/paypal-donate-brightgreen.svg)](https://bit.ly/2AS9QKB)\n\n`bitcoin:14fjysmpwLvSsAskvLASw6ek5XfhTzskHC`\n\n![Donate](https://www.tangrainc.com/qr.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterstaev%2Fnativescript-image-swipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterstaev%2Fnativescript-image-swipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterstaev%2Fnativescript-image-swipe/lists"}