Nativescript Swipe Card plugin
This plugin is inspired by https://www.nativescript.org/blog/tinder-style-cards-with-nativescript---love-at-first-swipe
Nativescript-swipe-card
Tender cards, allow you to drag them, and detect swipe events.
Developed with ❤️ by the team NativeBaguette 🥖
To know more about the {N} ambassador's program, you can check this video, or read this article.
Installation
tns plugin add nativescript-swipe-card
Usage
Typescript NativeScript
XML
main-page
;;;; // Event handler for Page 'loaded' event attached in main-page.xml
main-view-model
;;;;;;;
Fun fact! Team Time-Travel (Luna Kang, Stefan Medjo and mentor Jen Looper used the plugin to complete their 'Fetching' app - a Tinder app for dogs that uses the Petfinder API to help dogs to find puppy playdates in their area! https://github.com/jlooper/fetching-app-vanilla
Angular NativeScript
XML
Component
;;;;;;;elementRegistryModule.registerElement"SwipeCard",require"nativescript-swipe-card".SwipeCard;;
PS: I used this plugin in other application built in Angular, you can check it here: https://github.com/rkhayyat/SyrianForumFrance
API
Properties
Property | Type | Default | Description |
---|---|---|---|
swipeEvent |
function |
SwipeEvent |
Callback called when the layout is swiped to the right or left and the swipe animation is done. Return args:SwipeEvent: 1- direction (1 if right/2 if left), 2- cardIndex contain the card index |
Methods
Method | Return | Description |
---|---|---|
items |
Array<Layout> |
Array of card's layout, in which we can define the content of each card. |
cardHeight (optional) |
number |
Card's height in percentage of their container's height. |
cardWidth (optional) |
number |
Card's width in percentage of their container's width. |
cardBorderRadius (optional) |
number |
Card's border radius. |
cardBorderWidth (optional) |
number |
Card's border's width. |
isRandomColor (optional) |
number |
1: Set card's colors randomly & automatically. 2: Set card's colors manually. Default is 1. |
NativeBaguette 🥖
rhanb | rkhayyat | triniwiz | bradmartin | jlooper |