Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DeepestDesire opened this issue Sep 3, 2018 · 1 comment
Closed

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

DeepestDesire opened this issue Sep 3, 2018 · 1 comment
Labels

Comments

@DeepestDesire
Copy link

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

@xiaody
Copy link
Owner

xiaody commented Sep 3, 2018

I guess it should be something like

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

@xiaody xiaody added the question label Sep 3, 2018
@xiaody xiaody closed this as completed Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants