New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat react comp instance prop method #1458
Conversation
# Conflicts: # packages/core/src/platform/patch/react/getDefaultOptions.js
# Conflicts: # packages/webpack-plugin/lib/template-compiler/compiler.js
detail: null, | ||
...rawEvent.nativeEvent | ||
} | ||
const eventObj = rawEvent.customEvent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要修改原始事件对象,可以加个参数标识
Object.keys(newData).forEach((key) => { | ||
set(this, key, newData[key]) | ||
}) | ||
this.__mpxProxy.forceUpdate(callback) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mpxProxy.forceUpdate应该是for小程序的,rn下不应该调用
@@ -2535,7 +2537,11 @@ function postProcessComponentIs (el) { | |||
}) | |||
newChild.exps = el.exps | |||
addChild(tempNode, newChild) | |||
postProcessIf(newChild) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rn当中Component is可以实现得更优雅
# Conflicts: # packages/core/src/platform/patch/react/getDefaultOptions.js # packages/webpack-plugin/lib/template-compiler/compiler.js # packages/webpack-plugin/lib/template-compiler/gen-node-react.js
@@ -2426,6 +2426,7 @@ function processElement (el, root, options, meta) { | |||
processStyleReact(el) | |||
processEventReact(el, options, meta) | |||
processAttrs(el, options) | |||
processComponentIs(el, options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
放在processAttrs前面
function createInstance ({ props, ref, type, rawOptions, currentInject, validProps, components }) { | ||
const instance = Object.create({ | ||
setData () { | ||
setData (newData, callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setData和wx保持一致,基于forceUpdate实现
@@ -47,6 +68,9 @@ function createInstance ({ props, ref, type, rawOptions, currentInject, validPro | |||
return propsData | |||
}, | |||
__render () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
移除
跨端输出 react native 实例方法补充