mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
upgraded swiperjs to 8.0
This commit is contained in:
parent
ddbd51f534
commit
68bab520df
5 changed files with 36 additions and 35 deletions
|
@ -53,10 +53,19 @@ const NodeImageSwiperBlock: FC<IProps> = observer(({ node }) => {
|
|||
[images, controlledSwiper, showPhotoSwiper]
|
||||
);
|
||||
|
||||
// TODO: remove it if swiper 8 fixed sliding to first slide on init
|
||||
// useEffect(() => {
|
||||
// controlledSwiper?.slideTo(0, 0);
|
||||
// return () => controlledSwiper?.slideTo(0, 0);
|
||||
// }, [images, node?.id]);
|
||||
|
||||
useEffect(() => {
|
||||
controlledSwiper?.slideTo(0, 0);
|
||||
return () => controlledSwiper?.slideTo(0, 0);
|
||||
}, [images, node?.id]);
|
||||
if (isModalActive) {
|
||||
controlledSwiper?.keyboard.disable();
|
||||
} else {
|
||||
controlledSwiper?.keyboard.enable();
|
||||
}
|
||||
}, [isModalActive]);
|
||||
|
||||
if (!images?.length) {
|
||||
return null;
|
||||
|
@ -74,14 +83,6 @@ const NodeImageSwiperBlock: FC<IProps> = observer(({ node }) => {
|
|||
);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (isModalActive) {
|
||||
controlledSwiper?.keyboard.disable();
|
||||
} else {
|
||||
controlledSwiper?.keyboard.enable();
|
||||
}
|
||||
}, [isModalActive]);
|
||||
|
||||
return (
|
||||
<div className={styles.wrapper}>
|
||||
<Swiper
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue