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:Spinner组件delay属性不生效 Closes #9093 #9302

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions packages/amis-ui/scss/components/_spinner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
opacity: 1;
}

&.ing {
opacity: 0;
}

.#{$ns}Spinner-icon {
width: var(--Spinner-width);
height: var(--Spinner-height);
Expand Down
9 changes: 7 additions & 2 deletions packages/amis-ui/src/components/Spinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const fadeStyles: {
[propName: string]: string;
} = {
[ENTERED]: 'in',
[ENTERING]: 'in'
[ENTERING]: 'ing'
Copy link
Collaborator

Choose a reason for hiding this comment

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

修改了样式类名之后需要更新一下快照文件,具体更新的范围可以看CI里失败的单测

};

// Spinner Props
Expand Down Expand Up @@ -199,7 +199,11 @@ export class Spinner extends React.Component<
// 定义了挂载位置时只能使用默认icon
const icon = loadingConfig?.root ? undefined : iconConfig;
const isCustomIcon = icon && React.isValidElement(icon);
const timeout = {enter: delay, exit: 0};
const timeout = {
appear: delay,
enter: delay,
exit: 0
};

const showOverlay = loadingConfig?.root || overlay;

Expand All @@ -213,6 +217,7 @@ export class Spinner extends React.Component<
unmountOnExit
in={this.state.spinning}
timeout={timeout}
appear={this.state.spinning}
>
{(status: string) => {
return (
Expand Down
Loading