Skip to content

Commit

Permalink
fix(omi-transition): 修复同一个页面注册多次动画覆盖的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
duenyang committed Sep 26, 2024
1 parent 52151c3 commit fb39cd5
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"copy-to-clipboard": "^3.3.3",
"lodash": "~4.17.15",
"omi": "^7.7.1",
"omi-transition": "^0.1.10",
"omi-transition": "^0.1.11",
"tailwind-merge": "^2.2.1",
"tdesign-icons-web-components": "^0.1.4"
},
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export * from './popup';
export * from './progress';
export * from './radio';
export * from './range-input';
export * from './select';
export * from './select-input';
export * from './skeleton';
export * from './slider';
Expand Down
17 changes: 14 additions & 3 deletions src/popup/popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,12 @@ export default class Popup extends Component<PopupProps> {
this.updatePopper();
};

showPopupByControlled = () => {
this.isPopoverInDomTree = true;
this.update();
this.addPopContentEvent();
};

beforeUpdate() {
if (this.getVisible()) {
if (this.popperRef.current) {
Expand All @@ -310,11 +316,16 @@ export default class Popup extends Component<PopupProps> {
this.addTriggerEvent();

this.visible = this.props.visible;

// 初始化就显示时
if (this.visible) {
this.isPopoverInDomTree = true;
this.update();
this.addPopContentEvent();
this.showPopupByControlled();
}
}

receiveProps(props, oldProps) {
if (props.visible && oldProps.visible !== props.visible) {
this.showPopupByControlled();
}
}

Expand Down
1 change: 1 addition & 0 deletions src/select/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};

0 comments on commit fb39cd5

Please sign in to comment.