Skip to content
This repository has been archived by the owner on Feb 10, 2020. It is now read-only.

Support for React 16 #14

Open
DanaIliescu opened this issue Nov 12, 2017 · 10 comments
Open

Support for React 16 #14

DanaIliescu opened this issue Nov 12, 2017 · 10 comments

Comments

@DanaIliescu
Copy link

I've just recently came across this package which I think is great in terms of progressive web app and not native, but it seems like it doesn't support React 16.
With the most basic example I get
TypeError: cannot read property 'offsetWidth' of null

After downgrading to React 15.4.2 everything worked. Any chances it will support latest version soon?

@lasseborly
Copy link

@DanaIliescu track the bug down and submit a PR with the upgrade maybe?
I'm quite sure @alexandre-garrec would approve 😃

@yaoyonstudio
Copy link

yaoyonstudio commented Apr 10, 2018

@DanaIliescu I got the same problem, did you fixed it yet?

never mind. I change the default react/react-dom version in the library package.json file, reinstall the dependence, and everything works like expected.

@Raikhen
Copy link

Raikhen commented Oct 23, 2018

Yeah, @alexandre-garrec, if you could add support for React 16 it would be amazing!

@s10mcow
Copy link

s10mcow commented Feb 7, 2019

CHeck out this fork, works for me now https://github.com/damien-mcmahon/react-swipe-card

@leonardmaguin
Copy link

leonardmaguin commented Mar 14, 2019

@stenmuchow this worked for me to fix the offsetWidth.
The display worked but then I got the following while swipping and was unable to fix it yet.
Uncaught TypeError: this.props[("onSwipe" + direction)] is not a function

@leonardmaguin
Copy link

Fixed it by adding () =>
So the readme instructions become:

import Cards, { Card } from 'react-swipe-card'


const data = ['Alexandre', 'Thomas', 'Lucien']

const Wrapper = () => {
  return (
	  <Cards onEnd={() => action('end')} className='master-root'>
        {data.map(item => 
          <Card 
            onSwipeLeft={() => action('swipe left')} 
            onSwipeRight={() => action('swipe right')}>
            <h2>{item}</h2>
          </Card>
        )}
      </Cards>
  )
}

@haveamission
Copy link

CHeck out this fork, works for me now https://github.com/damien-mcmahon/react-swipe-card

When installing this via npm, React doesn't seem to be finding it:

npm install https://github.com/damien-mcmahon/react-swipe-card -g

I keep getting module not found

@josephecombs
Copy link

Fixed it by adding () =>
So the readme instructions become:

import Cards, { Card } from 'react-swipe-card'


const data = ['Alexandre', 'Thomas', 'Lucien']

const Wrapper = () => {
  return (
	  <Cards onEnd={() => action('end')} className='master-root'>
        {data.map(item => 
          <Card 
            onSwipeLeft={() => action('swipe left')} 
            onSwipeRight={() => action('swipe right')}>
            <h2>{item}</h2>
          </Card>
        )}
      </Cards>
  )
}

@leonardmaguin how do you import the "action" method above? The way I used to do this, Importing action depends on from @kadira/storybook, relies on React 15.xx, which will cause npm to try to use two versions of React in the same project.

@nghiaoi3
Copy link

nghiaoi3 commented Jan 10, 2020

anyone tries it with React 16? I encountered the same error! Please help.

@DanaIliescu
Copy link
Author

@nghiaoi3 I did not have success in finding a solve for this issue...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants