Skip to content

Commit 9b44591

Browse files
authored
Merge pull request #112 from dohooo/fix/autoplayError
fix: when autoPlay is false, manual sliding will still autoPlay
2 parents 3082b57 + 122082b commit 9b44591

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/hooks/useAutoPlay.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ export function useAutoPlay(opts: {
3535
}, []);
3636

3737
const start = React.useCallback(() => {
38+
if (!autoPlay) {
39+
return;
40+
}
3841
stopped.current = false;
3942
play();
40-
}, [play]);
43+
}, [play, autoPlay]);
4144

4245
React.useEffect(() => {
4346
if (autoPlay) {

0 commit comments

Comments
 (0)