Skip to content

Commit 2bfa12b

Browse files
committed
fix(onhover bugfix): onhover bug fixz
onhover prop breaks if you pass in keeplastframe prop too. fixed.
1 parent 1aa03b3 commit 2bfa12b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Player.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ export class Player extends React.Component<IPlayerProps, IPlayerState> {
337337
// Set handlers to auto play animation on hover if enabled
338338
this.container.addEventListener('mouseenter', () => {
339339
if (hover && this.state.playerState !== PlayerState.Playing) {
340+
if (this.props.keepLastFrame) {
341+
this.stop();
342+
}
340343
this.play();
341344
}
342345
});

stories/index.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ export const LottiePlayer = () => {
2020
<div style={{ width: '374px' }}>
2121
<Player
2222
src="https://assets1.lottiefiles.com/packages/lf20_ybj0fjlo.json"
23-
autoplay
23+
hover
2424
loop
2525
background="#ffffff"
2626
style={{ height: '300px' }}
2727
renderer="svg"
2828
onEvent={onEvent}
2929
className="test"
30+
keepLastFrame={true}
3031
>
3132
<Controls
3233
transparentTheme={true}

0 commit comments

Comments
 (0)