Skip to content

Commit 36112fe

Browse files
committed
fix: with the same key, split.
1 parent b5c94ae commit 36112fe

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/wild-toys-melt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'react-image-previewer': patch
3+
---
4+
5+
fix: with the same key, `split`.

packages/core/src/ui/DragToolbar.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,14 @@ export const DragToolbar: FC<DragToolbarProps> = ({
261261
className={className}
262262
>
263263
<StyledBox>
264-
{items.map(item => {
264+
{items.map((item, index) => {
265265
if (typeof item === 'string') {
266266
const Component = DragToolbarItemDefaultComponent[item]
267267
if (!Component) return null
268+
let key: string = item
269+
if (key === 'split') {
270+
key = `split-${index}`
271+
}
268272
return <Component key={item} {...props} />
269273
}
270274
const Component = item.component

0 commit comments

Comments
 (0)