Skip to content

Commit dabdba6

Browse files
committed
feat: fix mr
1 parent 9e49ee2 commit dabdba6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ global.__mpxPageSizeCountMap = reactive({})
1212

1313
global.__GCC = function (className, classMap, classMapValueCache) {
1414
if (!classMapValueCache.has(className)) {
15-
const _f = global.__formatValue
16-
const styleObj = classMap[className]?.(_f)
15+
const styleObj = classMap[className]?.(global.__formatValue)
1716
styleObj && classMapValueCache.set(className, styleObj)
1817
}
1918
return classMapValueCache.get(className)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ module.exports = function (styles, {
5252
global.__classCaches = global.__classCaches || []
5353
var __classCache = new Map()
5454
global.__classCaches.push(__classCache)`
55+
const formatValueName = '_f'
5556
const classMap = getClassMap({
5657
content,
5758
filename: loaderContext.resourcePath,
@@ -60,11 +61,11 @@ module.exports = function (styles, {
6061
ctorType,
6162
warn,
6263
error,
63-
formatValueName: '_f'
64+
formatValueName
6465
})
6566
const classMapCode = Object.entries(classMap).reduce((result, [key, value]) => {
6667
result !== '' && (result += ',')
67-
result += `${isValidIdentifierStr(key) ? `${key}` : `['${key}']`}: function(_f){return ${shallowStringify(value)};}`
68+
result += `${isValidIdentifierStr(key) ? `${key}` : `['${key}']`}: function(${formatValueName}){return ${shallowStringify(value)};}`
6869
return result
6970
}, '')
7071
if (ctorType === 'app') {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ function getClassMap ({ content, filename, mode, srcMode, ctorType, formatValueN
2525
value = matched[1]
2626
needStringify = false
2727
} else {
28-
value = `${formatValueName || 'global.__formatValue'}(${+matched[1]}, '${matched[2]}')`
28+
value = `${formatValueName}(${+matched[1]}, '${matched[2]}')`
2929
needStringify = false
3030
}
3131
}
3232
if (hairlineRegExp.test(value)) {
33-
value = `${formatValueName || 'global.__formatValue'}(${JSON.stringify(value)}, 'hairlineWidth')`
33+
value = `${formatValueName}(${JSON.stringify(value)}, 'hairlineWidth')`
3434
needStringify = false
3535
}
3636
return needStringify ? JSON.stringify(value) : value

0 commit comments

Comments
 (0)