Skip to content

Commit

Permalink
perf(alita): 移除 由于 RN bable 处理产生的多余属性
Browse files Browse the repository at this point in the history
  • Loading branch information
ykforerlang committed Dec 11, 2019
1 parent fdfcba5 commit 436d2a2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/wx-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@areslabs/wx-react",
"version": "2.0.0-beta.4",
"version": "2.0.0-beta.5",
"description": "微信版本的React",
"files": [
"package.json",
Expand Down
6 changes: 4 additions & 2 deletions packages/wx-react/src/createElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const TmpKey = "HOCKEY"

export default function createElement(comp, props, ...args) {
if (!comp) {
console.error(`组件为${comp}, 是否忘记导入??`)
console.error(`${props.__source.fileName} 文件存在 <XX />, 其中XX为undefined!请排查`)
return
}

Expand All @@ -29,7 +29,7 @@ export default function createElement(comp, props, ...args) {
}
}

const {animation, ref, key, tempName, tempVnode, CPTVnode, datakey, diuu, ...rprops} = props || {}
const {animation, ref, key, tempName, tempVnode, CPTVnode, datakey, diuu, __source, ...rprops} = props || {}

// 通用的不支持属性
if (props.onLayout) {
Expand Down Expand Up @@ -81,5 +81,7 @@ export default function createElement(comp, props, ...args) {
tempVnode,
CPTVnode,
datakey,

__source, // add by RN babel presets
}
}
2 changes: 2 additions & 0 deletions packages/wx-react/src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ export default function render(vnode, parentInst, parentContext, data, oldData,
updateRNBaseComponent(vnode, parentInst, parentContext, data, oldData, dataPath)
} else if (typeof nodeName === 'function') {
updateClassComponent(vnode, parentInst, parentContext, data, oldData, dataPath)
} else {
console.error(`${vnode.__source.fileName} 存在形式<XX/> 其中XX是${vnode.nodeName}!请排查`)
}
} catch (e) {
console.error(e)
Expand Down

0 comments on commit 436d2a2

Please sign in to comment.