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(imagePreview): 阻止关闭预览事件对父结构的非必要影响 #2227

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/packages/imagepreview/imagepreview.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ export const ImagePreview: FunctionComponent<Partial<ImagePreviewProps>> = (
setActive(page + 1)
props.onChange?.(page + 1)
}
const onCloseInner = () => {
const onCloseInner = (e: any) => {
oasis-cloud marked this conversation as resolved.
Show resolved Hide resolved
e.stopPropagation()
setShowPop(false)
setActive(innerNo)
scaleNow()
Expand All @@ -251,10 +252,10 @@ export const ImagePreview: FunctionComponent<Partial<ImagePreviewProps>> = (
scale: 1,
})
}
const closeOnImg = () => {
const closeOnImg = (e: any) => {
// 点击内容区域的图片是否可以关闭弹层(视频区域由于nut-video做了限制,无法关闭弹层)
if (closeOnContentClick) {
onCloseInner()
onCloseInner(e)
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/packages/imagepreview/imagepreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@
props.onChange?.(page + 1)
}

const onCloseInner = () => {
const onCloseInner = (e: any) => {
e.stopPropagation()

Check warning on line 243 in src/packages/imagepreview/imagepreview.tsx

View check run for this annotation

Codecov / codecov/patch

src/packages/imagepreview/imagepreview.tsx#L243

Added line #L243 was not covered by tests
setShowPop(false)
setActive(innerNo)
scaleNow()
Expand All @@ -250,10 +251,10 @@
})
}

const closeOnImg = () => {
const closeOnImg = (e: any) => {
// 点击内容区域的图片是否可以关闭弹层(视频区域由于nut-video做了限制,无法关闭弹层)
if (closeOnContentClick) {
onCloseInner()
onCloseInner(e)

Check warning on line 257 in src/packages/imagepreview/imagepreview.tsx

View check run for this annotation

Codecov / codecov/patch

src/packages/imagepreview/imagepreview.tsx#L257

Added line #L257 was not covered by tests
}
}
const duration = typeof autoPlay === 'string' ? parseInt(autoPlay) : autoPlay
Expand Down
Loading