feat(image): Image.PreviewGroup support preview.onChange callback (#40857)

* feat: imageGroup support onChange callback

* feat: reset code
This commit is contained in:
kiner-tang(文辉) 2023-02-21 21:21:51 +08:00 committed by GitHub
parent 6fc08687ae
commit 42e2b73cdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 6 deletions

View File

@ -2,7 +2,11 @@ import React from 'react';
import { Image } from 'antd';
const App: React.FC = () => (
<Image.PreviewGroup>
<Image.PreviewGroup
preview={{
onChange: (current, prev) => console.log(`current index: ${current}, prev index: ${prev}`),
}}
>
<Image width={200} src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" />
<Image
width={200}

View File

@ -43,10 +43,10 @@ Previewable image.
### previewType
```js
```typescript
{
visible?: boolean;
onVisibleChange?: (visible, prevVisible) => void;
onVisibleChange?: (visible, prevVisible, current: number) => void; // `current` only support after v5.3.0
getContainer?: string | HTMLElement | (() => HTMLElement); // v4.8.0
src?: string; // v4.10.0
mask?: ReactNode; // v4.9.0
@ -54,6 +54,7 @@ Previewable image.
current?: number; // v4.12.0 Only support PreviewGroup
countRender?: (current: number, total: number) => string // v4.20.0 Only support PreviewGroup
scaleStep?: number;
onChange?: (current: number, prevCurrent: number) => void; // only support after v5.3.0
}
```

View File

@ -44,10 +44,10 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*LVQ3R5JjjJEAAA
### previewType
```js
```typescript
{
visible?: boolean;
onVisibleChange?: (visible, prevVisible) => void;
onVisibleChange?: (visible, prevVisible, current: number) => void; // current 参数v5.3.0后支持
getContainer?: string | HTMLElement | (() => HTMLElement); // v4.8.0
src?: string; // v4.10.0
mask?: ReactNode; // v4.9.0
@ -56,6 +56,7 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*LVQ3R5JjjJEAAA
countRender?: (current: number, total: number) => string // v4.20.0 仅支持 PreviewGroup
scaleStep?: number;
forceRender?: boolean;
onChange?: (current: number, prevCurrent: number) => void; // v5.3.0后支持
}
```

View File

@ -126,7 +126,7 @@
"rc-drawer": "~6.1.1",
"rc-dropdown": "~4.0.0",
"rc-field-form": "~1.27.0",
"rc-image": "~5.15.1",
"rc-image": "~5.15.2",
"rc-input": "~0.2.1",
"rc-input-number": "~7.4.0",
"rc-mentions": "~2.0.0",