We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a56beac commit c42ef04Copy full SHA for c42ef04
src/utils/px-transform.ts
@@ -1,12 +1,7 @@
1
-import Taro, { pxTransform as transform } from '@tarojs/taro'
+import { pxTransform as transform } from '@tarojs/taro'
2
+import { harmony, rn } from './platform-taro'
3
4
export default function pxTransform(value: number) {
- const isHarmony = [
5
- Taro.ENV_TYPE.HARMONY,
6
- Taro.ENV_TYPE.HARMONYHYBRID,
7
- // @ts-ignore
8
- ].includes(Taro.getEnv())
9
-
10
- if (isHarmony) return transform(value)
11
- return value
+ if (harmony() && rn()) return transform(value)
+ return `${value}px`
12
}
0 commit comments