All Projects β†’ 3DJakob β†’ react-tinder-card

3DJakob / react-tinder-card

Licence: MIT license
A npm react module for making react elements swipeable like in the dating app tinder.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-tinder-card

Shuffle
πŸ”₯ A multi-directional card swiping library inspired by Tinder
Stars: ✭ 535 (+190.76%)
Mutual labels:  swipe, tinder
React Native Deck Swiper
tinder like react-native deck swiper
Stars: ✭ 1,261 (+585.33%)
Mutual labels:  swipe, tinder
React Native Card Stack Swiper
Tinder like react-native card stack swiper
Stars: ✭ 315 (+71.2%)
Mutual labels:  swipe, tinder
Tinderswipeview
Swipe view inspired by tinder
Stars: ✭ 289 (+57.07%)
Mutual labels:  swipe, tinder
SPStorkController
Now playing controller from Apple Music, Mail & Podcasts Apple's apps.
Stars: ✭ 2,515 (+1266.85%)
Mutual labels:  native, swipe
Ionic Tinder Ui
Just a Tinder UI on Ionic
Stars: ✭ 86 (-53.26%)
Mutual labels:  swipe, tinder
Verticalcardswiper
A marriage between the Shazam Discover UI and Tinder, built with UICollectionView in Swift.
Stars: ✭ 830 (+351.09%)
Mutual labels:  swipe, tinder
kikder-dating-swipe-app
❀️ Kik App, you know? πŸ’‘ Kikderβ„’ is a dating webapp that integrates the Kik, uses the HorOrNot game and the Tinder swipe. The F.A.S.T. Game Approach! The web app uses a custom lightweight MVC framework.
Stars: ✭ 21 (-88.59%)
Mutual labels:  swipe, tinder
Placeholderview
This library provides advance views for lists and stacks. Some of the views are build on top of RecyclerView and others are written in their own. Annotations are compiled by annotation processor to generate bind classes. DOCS -->
Stars: ✭ 2,104 (+1043.48%)
Mutual labels:  swipe, tinder
Swipeablecards
Stars: ✭ 136 (-26.09%)
Mutual labels:  swipe, tinder
Spstorkcontroller
Now playing controller from Apple Music, Mail & Podcasts Apple's apps.
Stars: ✭ 2,494 (+1255.43%)
Mutual labels:  native, swipe
Flare
A full-fledged unofficial Angular-based Tinder web client
Stars: ✭ 23 (-87.5%)
Mutual labels:  swipe, tinder
graderjs
πŸ’¦ Turn your full-stack NodeJS application into a downloadable cross-platform binary. Also works for SPAs, or regular web-sites.
Stars: ✭ 147 (-20.11%)
Mutual labels:  native
titanium-arkit
Use the iOS 11 ARKit API in Axway Titanium
Stars: ✭ 28 (-84.78%)
Mutual labels:  native
kotlin-native-mobile-multiplatform-example
Code sharing between iOS and Android with Kotlin native
Stars: ✭ 52 (-71.74%)
Mutual labels:  native
native-java-examples
Native Java Apps with Micronaut, Quarkus, and Spring Boot
Stars: ✭ 44 (-76.09%)
Mutual labels:  native
native-xr-for-web
Add iOS and Android build with AR capabilities to your website or web-based app.
Stars: ✭ 27 (-85.33%)
Mutual labels:  native
Multiplatform-LiveData
Multiplatorm implementation of LiveDatas / MVVM in kotlin android & native ios
Stars: ✭ 95 (-48.37%)
Mutual labels:  native
parcl
Gradle plugin for bundling your Java application for distribution on Windows, Mac and Linux
Stars: ✭ 52 (-71.74%)
Mutual labels:  native
generator-omaha
Yeoman generator designed to help you craft sustainable code for the modern web
Stars: ✭ 12 (-93.48%)
Mutual labels:  native

React Tinder Card

A react component to make swipeable elements like in the app tinder.

Compatibility

  • React
  • React Native

The import and api is identical for both Web and Native.

Demo

Try out the interactive demo here.

Check out the Web demo repo here.

Check out the Native demo repo here.

Contributing

Want to contribute? Check out the contributing.md.

Installation

npm install --save react-tinder-card

Usage

Import TinderCard and use the component like the snippet. Note that the component will not remove itself after swipe. If you want that behaviour implement that on the onCardLeftScreen callback. It is recommended to have overflow: hidden on your #root to prevent cards from being visible after they go of screen.

import TinderCard from 'react-tinder-card'

// ...

const onSwipe = (direction) => {
  console.log('You swiped: ' + direction)
}

const onCardLeftScreen = (myIdentifier) => {
  console.log(myIdentifier + ' left the screen')
}

return (
  <TinderCard onSwipe={onSwipe} onCardLeftScreen={() => onCardLeftScreen('fooBar')} preventSwipe={['right', 'left']}>Hello, World!</TinderCard>
)

If you want more usage help check out the demo repository code: Web / Native

The simple example is the minimum code needed to get you started.

The advanced example implements a state to dynamically remove swiped elements as well as using buttons to trigger swipes.

Both Web code examples can be tested on the demo page. The Native code examples can be cloned and runned using expo start.

Props

flickOnSwipe

  • optional
  • type: boolean
  • default: true

Whether or not to let the element be flicked away off-screen after a swipe.

onSwipe

  • optional
  • type: SwipeHandler

Callback that will be executed when a swipe has been completed. It will be called with a single string denoting which direction the swipe was in: 'left', 'right', 'up' or 'down'.

onCardLeftScreen

  • optional
  • type: CardLeftScreenHandler

Callback that will be executed when a TinderCard has left the screen. It will be called with a single string denoting which direction the swipe was in: 'left', 'right', 'up' or 'down'.

preventSwipe

  • optional
  • type: Array<string>
  • default: []

An array of directions for which to prevent swiping out of screen. Valid arguments are 'left', 'right', 'up' and 'down'.

swipeRequirementType

  • optional
  • type: 'velocity' | 'position'
  • default: 'velocity'

What method to evaluate what direction to throw the card on release. 'velocity' will evaluate direction based on the direction of the swiping movement. 'position' will evaluate direction based on the position the card has on the screen like in the app tinder. If set to position it is recommended to manually set swipeThreshold based on the screen size as not all devices will accommodate the default distance of 300px and the default native swipeThreshold is 1px which most likely is undesirably low.

swipeThreshold

  • optional
  • type: number
  • default: 300

The threshold of which to accept swipes. If swipeRequirementType is set to velocity it is the velocity threshold and if set to position it is the position threshold. On native the default value is 1 as the physics works differently there. If swipeRequirementType is set to position it is recommended to set this based on the screen width so cards can be swiped on all screen sizes.

onSwipeRequirementFulfilled

  • optional
  • type: SwipeRequirementFufillUpdate

Callback that will be executed when a TinderCard has fulfilled the requirement necessary to be swiped in a direction on release. This in combination with onSwipeRequirementUnfulfilled is useful for displaying user feedback on the card. When using this it is recommended to use swipeRequirementType='position' as this will fire a lot otherwise. It will be called with a single string denoting which direction the user is swiping: 'left', 'right', 'up' or 'down'.

onSwipeRequirementUnfulfilled

  • optional
  • type: SwipeRequirementUnfufillUpdate

Callback that will be executed when a TinderCard has unfulfilled the requirement necessary to be swiped in a direction on release.

className

  • optional
  • type: string

HTML attribute class

API

swipe([dir])

  • dir (Direction, optional) - The direction in which the card should be swiped. One of: 'left', 'right', 'up' and 'down'.
  • returns Promise<void>

Programmatically trigger a swipe of the card in one of the valid directions 'left', 'right', 'up' and 'down'. This function, swipe, can be called on a reference of the TinderCard instance. Check the example code for more details on how to use this.

restoreCard()

  • returns Promise<void>

Restore swiped-card state. Use this function if you want to undo a swiped-card (e.g. you have a back button that shows last swiped card or you have a reset button. The promise is resolved once the card is returned

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].