Skip to content

Commit 3243e13

Browse files
committed
fix(divider): 解决单位编译不正确的问题 #1725
1 parent 8927199 commit 3243e13

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,8 @@ function handleTouchScroll(flag: any): void {
214214

215215
function pxTransform(size: number): string {
216216
if (!size) return ''
217-
const designWidth = 750
218-
const deviceRatio = {
219-
640: 2.34 / 2,
220-
750: 1,
221-
828: 1.81 / 2
222-
}
223-
return `${size / deviceRatio[designWidth]}rpx`
217+
218+
return Taro.pxTransform(size)
224219
}
225220

226221
function objectToString(style: object | string): string {

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,8 @@ function handleTouchScroll(flag: any): void {
214214

215215
function pxTransform(size: number): string {
216216
if (!size) return ''
217-
const designWidth = 750
218-
const deviceRatio = {
219-
640: 2.34 / 2,
220-
750: 1,
221-
828: 1.81 / 2
222-
}
223-
return `${size / deviceRatio[designWidth]}rpx`
217+
218+
return Taro.pxTransform(size)
224219
}
225220

226221
function objectToString(style: object | string): string {

0 commit comments

Comments
 (0)