Skip to content

Commit 0431c99

Browse files
committed
fix(rn): popup 连续调用show\hide导致显示失败
1 parent c537ff3 commit 0431c99

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

packages/mpx-cube-ui/lib/components/popup/rn-mixin.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ if (__mpx_mode__ === 'ios' || __mpx_mode__ === 'android') {
4545
},
4646
'cube-popup_transition': (animationOptions) => {
4747
if (!this.isVisible) {
48-
setTimeout(() => {
49-
this.display = false;
48+
clearTimeout(this.dispalyTimer);
49+
this.dispalyTimer = setTimeout(() => {
50+
if (!this.isVisible) {
51+
this.display = false;
52+
}
5053
// fix 玄学,不加 100ms ,drn 动画会非常卡
5154
}, animationOptions.duration + 100);
5255
}

packages/mpx-cube-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mpxjs/mpx-cube-ui",
3-
"version": "1.3.14-beta.3",
3+
"version": "1.3.14-beta.4",
44
"description": "mpx components library",
55
"author": "xiaolei <[email protected]>",
66
"publishConfig": {

packages/mpx-cube-ui/src/components/popup/rn-mixin.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ if (__mpx_mode__ === 'ios' || __mpx_mode__ === 'android') {
5151
},
5252
'cube-popup_transition': (animationOptions) => {
5353
if (!this.isVisible) {
54-
setTimeout(() => {
55-
this.display = false
54+
clearTimeout(this.dispalyTimer)
55+
this.dispalyTimer = setTimeout(() => {
56+
if (!this.isVisible) {
57+
this.display = false
58+
}
5659
// fix 玄学,不加 100ms ,drn 动画会非常卡
5760
}, animationOptions.duration + 100)
5861
}

0 commit comments

Comments
 (0)