xiaody/react-touch-carousel

Follw the usage, I can't use this carousel.

DeepestDesire opened this issue · 1 comments

import React from 'react';
import TouchCarousel from 'react-touch-carousel'
class App extends React.Component {

carouselComponent() {
    return (
        <div style={{backgroundColor: "yellow", height:400, width: "90%"}}>

        </div>
    )
}

renderCard(index, modIndex) {
    return (
        <div style= {{color: "red"}}>
            {index}
            <div>
                <div className='carousel-title'>{'title'}</div>
                <div className='carousel-text'>{'text'}</div> 
            </div>
        </div>
    )
}

render() {
    return (
        <TouchCarousel
            component={this.carouselComponent.bind(this)}
            cardCount={3}
            cardSize={375}
            renderCard={this.renderCard.bind(this)}
            loop
            autoplay={3000}
        />
    )
}
}

 export default App

2018-09-03 4 42 28 1

I can't see renderCard's component

I guess it should be something like

carouselComponent(props) {
    return (
        <div style={{backgroundColor: "yellow", height:400, width: "90%"}}>
            {props.children}
        </div>
    )
}