Skip to content

Commit

Permalink
feat: Allow setting 'force segments' flag
Browse files Browse the repository at this point in the history
  • Loading branch information
felippenardi committed Jul 29, 2018
1 parent ec550bf commit 0338b8b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export default class Lottie extends React.Component {
if (this.props.isStopped) {
this.stop();
} else if (this.props.segments) {
this.playSegments();
const shouldForce = !!this.props.forceSegments;
this.playSegments(shouldForce);
} else {
this.play();
}
Expand Down Expand Up @@ -77,8 +78,8 @@ export default class Lottie extends React.Component {
this.anim.play();
}

playSegments() {
this.anim.playSegments(this.props.segments);
playSegments(shouldForce) {
this.anim.playSegments(this.props.segments, shouldForce);
}

stop() {
Expand Down Expand Up @@ -165,6 +166,7 @@ Lottie.propTypes = {
isPaused: PropTypes.bool,
speed: PropTypes.number,
segments: PropTypes.arrayOf(PropTypes.number),
forceSegments: PropTypes.bool,
direction: PropTypes.number,
ariaRole: PropTypes.string,
ariaLabel: PropTypes.string,
Expand Down

0 comments on commit 0338b8b

Please sign in to comment.