Skip to content

Commit c9f875b

Browse files
committed
feat(rn): popup添加自动刷新能力
1 parent 649159f commit c9f875b

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

packages/mpx-cube-ui/lib/components/popup/index.mpx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@
6666
wx:ref="popup-content"
6767
class="cube-popup-content {{ transition }}"
6868
wx:style="{{ [styleConfig.content, contentTranslateStyle] }}"
69-
animation="{{ animationData }}">
69+
animation="{{ animationData }}"
70+
onLayout="onLayout">
7071
<slot></slot>
7172
</view>
7273
</view>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ if (__mpx_mode__ === 'ios' || __mpx_mode__ === 'android') {
8989
}
9090
},
9191
methods: {
92+
onLayout() {
93+
if (!this.layoutCount) {
94+
this.layoutCount = 1;
95+
return;
96+
}
97+
this.layoutCount++;
98+
this.initContentRect();
99+
},
92100
getWindowInfo() {
93101
if (this.windowInfo)
94102
return this.windowInfo;

packages/mpx-cube-ui/src/components/popup/index.mpx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@
6666
wx:ref="popup-content"
6767
class="cube-popup-content {{ transition }}"
6868
wx:style="{{ [styleConfig.content, contentTranslateStyle] }}"
69-
animation="{{ animationData }}">
69+
animation="{{ animationData }}"
70+
onLayout="onLayout">
7071
<slot></slot>
7172
</view>
7273
</view>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ if (__mpx_mode__ === 'ios' || __mpx_mode__ === 'android') {
9797
}
9898
},
9999
methods: {
100+
onLayout() {
101+
if (!this.layoutCount) {
102+
this.layoutCount = 1
103+
return
104+
}
105+
this.layoutCount++
106+
this.initContentRect()
107+
},
100108
getWindowInfo() {
101109
if (this.windowInfo) return this.windowInfo
102110
return (this.windowInfo = mpx.getWindowInfo())

0 commit comments

Comments
 (0)