Skip to content

Commit 9383a54

Browse files
robinv8Saraph1nes
andauthored
Fix/bug (#1753)
* fix(swipe-action): 修复在 h5 环境下点击事件失效的问题 * fix(tabs): 修复 h5 环境下样式报错的问题 * refactor(types): 完善类型声明 * chore: 修复在Windows环境下样式文件拷贝的路径分隔符问题 (#1752) 解决了在Windows环境下的路径分隔符问题,该问题导致样式文件无法正确拷贝。 Co-authored-by: xiayuxuan <[email protected]> * refactor(type): Add onChooseAvatar event handler to TaroButtonProps 相关问题:#1736 * fix: 解决小程序下无法获取元素信息的问题 相关问题:#1734 --------- Co-authored-by: Xia Yuxuan <[email protected]> Co-authored-by: xiayuxuan <[email protected]>
1 parent a93f319 commit 9383a54

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

packages/taro-ui/rn/common/utils.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ function delayQuerySelector(
1717
delayTime = 500
1818
): Promise<any[]> {
1919
return new Promise(resolve => {
20-
const selector: SelectorQuery = Taro.createSelectorQuery()
21-
delay(delayTime).then(() => {
22-
selector
23-
.select(selectorStr)
24-
.boundingClientRect()
25-
.exec((res: any[]) => {
26-
resolve(res)
27-
})
20+
Taro.nextTick(() => {
21+
const selector: SelectorQuery = Taro.createSelectorQuery()
22+
delay(delayTime).then(() => {
23+
selector
24+
.select(selectorStr)
25+
.boundingClientRect()
26+
.exec((res: any[]) => {
27+
resolve(res)
28+
})
29+
})
2830
})
2931
})
3032
}

packages/taro-ui/src/common/utils.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ function delayQuerySelector(
1717
delayTime = 500
1818
): Promise<any[]> {
1919
return new Promise(resolve => {
20-
const selector: SelectorQuery = Taro.createSelectorQuery()
21-
delay(delayTime).then(() => {
22-
selector
23-
.select(selectorStr)
24-
.boundingClientRect()
25-
.exec((res: any[]) => {
26-
resolve(res)
27-
})
20+
Taro.nextTick(() => {
21+
const selector: SelectorQuery = Taro.createSelectorQuery()
22+
delay(delayTime).then(() => {
23+
selector
24+
.select(selectorStr)
25+
.boundingClientRect()
26+
.exec((res: any[]) => {
27+
resolve(res)
28+
})
29+
})
2830
})
2931
})
3032
}

0 commit comments

Comments
 (0)