Skip to content

Commit

Permalink
🐛 fix: 修正layout和columns不受控的 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Sep 13, 2021
1 parent 1d1d8e3 commit 90f9265
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/asset-gallery/src/AssetGallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ const AssetGallery: FC<AssetGalleryProps> = ({
layout: layoutProps,
logo,
showSlider = true,
onLayoutChange,
columns: columnsProps,
onColumnsChange,
style,
}) => {
const [columns, setColumn] = useMergeValue(4, { defaultValue: columnsProps });
const [columns, setColumn] = useMergeValue(4, {
value: columnsProps,
onChange: onColumnsChange,
});
const [layout, setLayout] = useMergeValue('masonry', {
defaultValue: layoutProps,
value: layoutProps,
onChange: onLayoutChange,
});

const imageList = typeof data === 'string' ? YMLToJSON(data).data : data;
Expand Down

1 comment on commit 90f9265

@vercel
Copy link

@vercel vercel bot commented on 90f9265 Sep 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.