alexandre-garrec / react-swipe-card

Tinder style swipe cards
https://alexandre-garrec.github.io/react-swipe-card
136 stars 79 forks source link

Not rendering any cards #4

Open ThomasDebrunner opened 7 years ago

ThomasDebrunner commented 7 years ago

In my most basic example, I can't manage to get the cards appear on the screen.


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

export default class Stack extends Component {

  render() {
    const { actions, children, login } = this.props

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

    return (
      <div className={style.normal}>
        <Header>Stack</Header>
        <Cards onEnd={() => console.log('end')} className='master-root'>
            {data.map((item, i) =>
              <Card key={i}
                onSwipeLeft={() => console.log('swipe left')}
                onSwipeRight={() => console.log('swipe right')}>
                <h2>{item}</h2>
              </Card>
            )}
          </Cards>
      </div>
    )
  }
}

All it renders is a div with the master-root class set, but without any children. Any idea what could go wrong?

alexandre-garrec commented 7 years ago

Can you try with the css file in storybook/style.css ?

master-root need a size

dmoli commented 7 years ago

@alexandre-garrec I had the same problem, I think that you must to specify that the CSS is necessary to run it successfully.