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

Fix autoplay & add initialFrame prop #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

maciekpastuszka
Copy link

@maciekpastuszka maciekpastuszka commented Feb 21, 2019

Example code to issue reproduce:
<Rotation cycle={true} autoPlay={this.state.autoPlay} onChange={(frame) => { if (frame === 10) { this.setState({ autoPlay: false })

Expected behavior: Start initially autoPlay then stop spinning after 10 frame.

Issue: The prop autoPlay changes to false, method stop fires but spinning doesn't stop because of async setTimeout in nextFrame method

Also I added initialFrame prop

@maciekpastuszka maciekpastuszka changed the title Fix autoplay Fix autoplay & add initialFrame prop Feb 21, 2019
@maciekpastuszka
Copy link
Author

@andrepolischuk Could you take a look :)

if (autoPlay !== this.props.autoPlay) {
if (autoPlay) {
this.nextFrame()
} else {
this.stop()
}
}

if (initialFrame !== this.props.initialFrame) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you update current frame when change initial frame property? it seems to me that initialFrame is the same with input's defaultValue property, but default value works only on mount (not on update)

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

Successfully merging this pull request may close these issues.

2 participants