Skip to content

Commit 88017d4

Browse files
authored
Merge branch 'master' into feat-router-lock-addpath-v2
2 parents 25e569d + c7777ff commit 88017d4

6 files changed

Lines changed: 21 additions & 5 deletions

File tree

docs-vitepress/guide/rn/style.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,10 @@ transform: scale(1.2) skewX(10deg);
13691369
/* RN 数组格式,仅 rn 支持 */
13701370
transform: [{translateX: 50}, {rotate: '45deg'}];
13711371
```
1372+
> [!tip] 注意
1373+
>
1374+
> 1.RN transform 不支持 scaleZ/scale3d/translateZ/translate3d/rotate3d/matrix3d
1375+
> 2.skew/skewX/skewY 在 RN Android 上不生效
13721376

13731377
### transform-origin
13741378

packages/core/src/platform/builtInMixins/styleHelperMixin.ios.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ global.__mpxAppDimensionsInfo = {
1010
global.__mpxSizeCount = 0
1111
global.__mpxPageSizeCountMap = reactive({})
1212

13-
global.__classCaches = []
1413
global.__GCC = function (className, classMap, classMapValueCache) {
15-
if (!classMapValueCache.get(className)) {
14+
if (!classMapValueCache.has(className)) {
1615
const styleObj = classMap[className]?.()
1716
styleObj && classMapValueCache.set(className, styleObj)
1817
}

packages/webpack-plugin/lib/react/processStyles.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ module.exports = function (styles, {
6464
}, '')
6565
if (ctorType === 'app') {
6666
output += `
67+
global.__classCaches = global.__classCaches || []
6768
const __classCache = new Map()
6869
global.__classCaches.push(__classCache)
6970
let __appClassMap
@@ -75,6 +76,7 @@ module.exports = function (styles, {
7576
};\n`
7677
} else {
7778
output += `
79+
global.__classCaches = global.__classCaches || []
7880
const __classCache = new Map()
7981
global.__classCaches.push(__classCache)
8082
let __classMap

packages/webpack-plugin/lib/react/style-helper.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ const hairlineRegExp = /^\s*hairlineWidth\s*$/
99
const varRegExp = /^--/
1010
const cssPrefixExp = /^-(webkit|moz|ms|o)-/
1111
function getClassMap ({ content, filename, mode, srcMode, ctorType, warn, error }) {
12-
const classMap = ctorType === 'page' ? { [MPX_TAG_PAGE_SELECTOR]: { flex: 1 } } : {}
12+
const classMap = ctorType === 'page'
13+
? {
14+
[MPX_TAG_PAGE_SELECTOR]: {
15+
_media: [],
16+
_default: { flex: 1, height: "'100%'" }
17+
}
18+
}
19+
: {}
1320

1421
const root = postcss.parse(content, {
1522
from: filename

packages/webpack-plugin/lib/runtime/components/react/mpx-portal/portal-manager.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const _PortalManager = forwardRef((props: PortalManagerProps, ref:ForwardedRef<u
1919
setState((prevState) => ({
2020
portals: [...prevState.portals, { key, children }]
2121
}))
22-
}, [state])
22+
}, [])
2323

2424
const update = useCallback((key: number, children: ReactNode) => {
2525
setState((prevState) => ({
@@ -30,7 +30,7 @@ const _PortalManager = forwardRef((props: PortalManagerProps, ref:ForwardedRef<u
3030
return item
3131
})
3232
}))
33-
}, [state])
33+
}, [])
3434

3535
const unmount = useCallback((key: number) => {
3636
setState((prevState) => ({

packages/webpack-plugin/lib/runtime/components/react/utils.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ function transformStringify (styleObj: Record<string, any>) {
288288
if (isNumber(styleObj.fontWeight)) {
289289
styleObj.fontWeight = '' + styleObj.fontWeight
290290
}
291+
// transformOrigin 20px 需要转换为 transformOrigin '20'
292+
if (isNumber(styleObj.transformOrigin)) {
293+
styleObj.transformOrigin = '' + styleObj.transformOrigin
294+
}
291295
}
292296

293297
function transformPosition (styleObj: Record<string, any>, meta: PositionMeta) {

0 commit comments

Comments
 (0)