Giter VIP home page Giter VIP logo

react-tinder-card-demo's Introduction

React Tinder Card Demo

A demo project to my react-tinder-card npm module.

Try the demo

Try the demo on the gh-pages site here!

The code

Feel free to check out the code in react-tinder-card-demo/src/examples for a usage example of how this application uses the module.

Simple

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

Advanced

The advanced example implements a state with references to swipe and restore cards using buttons.

Demo

Both code examples can be tested on the demo page.

react-tinder-card-demo's People

Contributors

3djakob avatar luk-z avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

react-tinder-card-demo's Issues

useLayoutEffect Warning

Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.

in index.js

React.useLayoutEffect(() => {
let offset = { x: null, y: null }
let speed = { x: 0, y: 0 }
let lastLocation = { x: 0, y: 0, time: new Date().getTime() }
let mouseIsClicked = false

How can I adjust this to get around this warning, please

My package.json
...

"dependencies": {
"@popperjs/core": "^2.9.0",
"@tailwindcss/postcss7-compat": "^2.0.2",
"autoprefixer": "^9",
"axios": "^0.21.1",
"dotenv": "^8.2.0",
"isomorphic-unfetch": "^3.1.0",
"next": "10.0.5",
"next-images": "^1.7.0",
"popper.js": "1.15.0",
"postcss": "^8.1.4",
"react": "17.0.1",
"react-accessible-accordion": "^3.3.4",
"react-awesome-reveal": "^3.7.1",
"react-collapsible": "^2.8.3",
"react-dom": "17.0.1",
"react-icons": "^4.2.0",
"react-responsive": "^7",
"react-tabs": "^3.2.0",
"react-tinder-card": "^1.3.1",
"react-transition-group": "^4.4.1",
"sass": "^1.32.5",
"swr": "^0.5.3"
},
"devDependencies": {
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-import": "^14.0.0",
"postcss-preset-env": "^6.7.0",
"precss": "^4.0.0",
"tailwindcss": "npm:@tailwindcss/postcss7-compat"
}
}...

Typo

There's a small typo in Advanced.js : alredyRemoved instead of alreadyRemoved.
Absolutely not code-breaking, just makes a small semantic error.

No animations for bottom and top with button trigger

Hi, I'm not able to see any animation when I use the advanced example with swipe('top') or swipe('bottom') value. If I change to swipe('left') or swipe('right'), it works perfectly. I don't understand why.

Typing preventSwipe

There is an issue with typing preventSwipe?: [String], with more that one string in typescript.
Change it to String[].

fun

this is neat

remove card after leave screen

When the card leaves the screen it doesn't get removed
is there any way to remove or hide the element after it has left the screen?

Pass event.target.value to onSwipe function

Is it possible to do this? I would like to pass the key property value to the onSwipe function.
<TinderCard
className="swipe"
//key={person.name}//
key={person.email}
preventSwipe={["up", "down"]}
onSwipe={(e) => onSwipe(e.target.key)}
flickOnSwipe={true}
>

styles are not add

Styles are not add, i have installed this library, imported it, all working good, but without styles

advanced example: usage of useMemo and useEffect at the same time

Hi!

I use TinderCard with getting data from firebase via useEffect first. The example is shown with a local data-array - where it's easy to initially use the useMemo-hook (to get the binding to the TinderCard-html-element later).

In my case, with getting asynchronous data from a database first and storing them in a useState-hook:
const [users, setUsers] = useState([] as any[]);

… it's not possible to initialize the useMemo-hook, because the data isn’t loaded yet (as both hooks fire at the same time I guess).

I just want to achieve to do the swipe-animation when a button is pressed, but I can’t get the binding without useMemo (or?).
Any ideas how I can manage this? I already thought about something like putting a short timeout before executing useMemo, but I don’t know how to do this.

Thanks a lot in advance! :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.