Skip to content

Add an onActive prop to slides #324

@jacobwindsor

Description

@jacobwindsor

I suggest adding an onActive prop to slides that can be passed a callback that will be called when the slide is brought into view. This callback would be called with the slide number.

My use case is that I am altering the parent component of the Slide when a slide comes into view and need to know when and what slide is in view.

Calling the callback with the slide number may not be the best option.

Example

class extends Component {
    onActive(slideNumber) {
        console.log("The active slide is " + slideNumber)
    }
    
    render() {
         return (
            <Deck>
                <Slide onActive={this.onActive} />
                <Slide onActive={this.onActive} />
            </Deck>
        )
    }
}

Metadata

Metadata

Assignees

Labels

Feature RequestRequest for or introduction of new functionality

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions